|
|
12a457 |
From 531bbee43de55dd9c38072b34f9aab181873aa6c Mon Sep 17 00:00:00 2001
|
|
|
12a457 |
From: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
12a457 |
Date: Sat, 27 Feb 2016 23:08:06 +0530
|
|
|
12a457 |
Subject: [PATCH 65/80] cluster/afr: Don't delete gfid-req from lookup request
|
|
|
12a457 |
|
|
|
12a457 |
Problem:
|
|
|
12a457 |
Afr does dict_ref of the xattr_req that comes to it and deletes "gfid-req" key.
|
|
|
12a457 |
Dht uses same dict to send lookup to other subvolumes. So in case of
|
|
|
12a457 |
directories and more than 1 dht subvolumes, second subvolume till the last
|
|
|
12a457 |
subvolume won't get a lookup request with "gfid-req". So gfid reset never
|
|
|
12a457 |
happens on the directories in distributed replicate subvolume for 2nd till last
|
|
|
12a457 |
subvolumes.
|
|
|
12a457 |
|
|
|
12a457 |
Fix:
|
|
|
12a457 |
Make a copy of lookup xattr request.
|
|
|
12a457 |
|
|
|
12a457 |
Also fixed replies_wipe possibly resetting gfid to NULL gfid
|
|
|
12a457 |
|
|
|
12a457 |
>BUG: 1312816
|
|
|
12a457 |
>Change-Id: Ic16260e5a4664837d069c1dc05b9e96ca05bda88
|
|
|
12a457 |
>Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
12a457 |
>Reviewed-on: http://review.gluster.org/13545
|
|
|
12a457 |
>Smoke: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
12a457 |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
>Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
|
|
|
12a457 |
|
|
|
12a457 |
BUG: 1318427
|
|
|
12a457 |
Change-Id: Ic6b5e8c36685812031fd5c5497ae6b600e23bc38
|
|
|
12a457 |
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
12a457 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/71971
|
|
|
12a457 |
---
|
|
|
12a457 |
tests/basic/afr/gfid-heal.t | 20 ++++++++++++++++++++
|
|
|
12a457 |
xlators/cluster/afr/src/afr-common.c | 10 +++++++---
|
|
|
12a457 |
xlators/cluster/afr/src/afr-self-heal-name.c | 4 ++--
|
|
|
12a457 |
3 files changed, 29 insertions(+), 5 deletions(-)
|
|
|
12a457 |
create mode 100644 tests/basic/afr/gfid-heal.t
|
|
|
12a457 |
|
|
|
12a457 |
diff --git a/tests/basic/afr/gfid-heal.t b/tests/basic/afr/gfid-heal.t
|
|
|
12a457 |
new file mode 100644
|
|
|
12a457 |
index 0000000..e570f3d
|
|
|
12a457 |
--- /dev/null
|
|
|
12a457 |
+++ b/tests/basic/afr/gfid-heal.t
|
|
|
12a457 |
@@ -0,0 +1,20 @@
|
|
|
12a457 |
+#!/bin/bash
|
|
|
12a457 |
+#gfid self-heal test on distributed replica. Make sure all the gfids are same
|
|
|
12a457 |
+#and the gfid exists on all the bricks
|
|
|
12a457 |
+
|
|
|
12a457 |
+. $(dirname $0)/../../include.rc
|
|
|
12a457 |
+. $(dirname $0)/../../volume.rc
|
|
|
12a457 |
+cleanup;
|
|
|
12a457 |
+
|
|
|
12a457 |
+TEST glusterd
|
|
|
12a457 |
+TEST pidof glusterd
|
|
|
12a457 |
+TEST $CLI volume create $V0 replica 2 $H0:$B0/brick{0,1,2,3}
|
|
|
12a457 |
+TEST $CLI volume start $V0
|
|
|
12a457 |
+TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0;
|
|
|
12a457 |
+
|
|
|
12a457 |
+TEST mkdir $B0/brick{0,1,2,3}/d
|
|
|
12a457 |
+sleep 2 #to prevent is_fresh_file code path
|
|
|
12a457 |
+TEST stat $M0/d
|
|
|
12a457 |
+gfid_count=$(getfattr -d -m. -e hex $B0/brick{0,1,2,3}/d 2>&1 | grep trusted.gfid | wc -l)
|
|
|
12a457 |
+EXPECT 4 echo $gfid_count
|
|
|
12a457 |
+cleanup;
|
|
|
12a457 |
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
|
|
|
12a457 |
index 6b393c7..308766c 100644
|
|
|
12a457 |
--- a/xlators/cluster/afr/src/afr-common.c
|
|
|
12a457 |
+++ b/xlators/cluster/afr/src/afr-common.c
|
|
|
12a457 |
@@ -2547,12 +2547,16 @@ afr_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req)
|
|
|
12a457 |
if (xattr_req) {
|
|
|
12a457 |
/* If xattr_req was null, afr_lookup_xattr_req_prepare() will
|
|
|
12a457 |
allocate one for us */
|
|
|
12a457 |
- ret = dict_get_ptr (xattr_req, "gfid-req", &gfid_req);
|
|
|
12a457 |
+ local->xattr_req = dict_copy_with_ref (xattr_req, NULL);
|
|
|
12a457 |
+ if (!local->xattr_req) {
|
|
|
12a457 |
+ op_errno = ENOMEM;
|
|
|
12a457 |
+ goto out;
|
|
|
12a457 |
+ }
|
|
|
12a457 |
+ ret = dict_get_ptr (local->xattr_req, "gfid-req", &gfid_req);
|
|
|
12a457 |
if (ret == 0) {
|
|
|
12a457 |
gf_uuid_copy (local->cont.lookup.gfid_req, gfid_req);
|
|
|
12a457 |
- dict_del (xattr_req, "gfid-req");
|
|
|
12a457 |
+ dict_del (local->xattr_req, "gfid-req");
|
|
|
12a457 |
}
|
|
|
12a457 |
- local->xattr_req = dict_ref (xattr_req);
|
|
|
12a457 |
}
|
|
|
12a457 |
|
|
|
12a457 |
afr_read_subvol_get (loc->parent, this, NULL, &event,
|
|
|
12a457 |
diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c
|
|
|
12a457 |
index e32b81c..6155298 100644
|
|
|
12a457 |
--- a/xlators/cluster/afr/src/afr-self-heal-name.c
|
|
|
12a457 |
+++ b/xlators/cluster/afr/src/afr-self-heal-name.c
|
|
|
12a457 |
@@ -88,11 +88,11 @@ __afr_selfheal_assign_gfid (xlator_t *this, inode_t *parent, uuid_t pargfid,
|
|
|
12a457 |
* __afr_selfheal_name_impunge().
|
|
|
12a457 |
*/
|
|
|
12a457 |
|
|
|
12a457 |
- afr_replies_wipe (replies, priv->child_count);
|
|
|
12a457 |
-
|
|
|
12a457 |
AFR_ONLIST (locked_on, new_frame, afr_selfheal_discover_cbk, lookup,
|
|
|
12a457 |
&loc, xdata);
|
|
|
12a457 |
|
|
|
12a457 |
+ afr_replies_wipe (replies, priv->child_count);
|
|
|
12a457 |
+
|
|
|
12a457 |
afr_replies_copy (replies, new_local->replies, priv->child_count);
|
|
|
12a457 |
|
|
|
12a457 |
out:
|
|
|
12a457 |
--
|
|
|
12a457 |
1.7.1
|
|
|
12a457 |
|