summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/basic/afr/gfid-heal.t20
-rw-r--r--tests/bugs/replicate/bug-1297695.t2
-rw-r--r--xlators/cluster/afr/src/afr-common.c10
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-name.c4
4 files changed, 30 insertions, 6 deletions
diff --git a/tests/basic/afr/gfid-heal.t b/tests/basic/afr/gfid-heal.t
new file mode 100644
index 00000000000..e570f3d5951
--- /dev/null
+++ b/tests/basic/afr/gfid-heal.t
@@ -0,0 +1,20 @@
+#!/bin/bash
+#gfid self-heal test on distributed replica. Make sure all the gfids are same
+#and the gfid exists on all the bricks
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 replica 2 $H0:$B0/brick{0,1,2,3}
+TEST $CLI volume start $V0
+TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0;
+
+TEST mkdir $B0/brick{0,1,2,3}/d
+sleep 2 #to prevent is_fresh_file code path
+TEST stat $M0/d
+gfid_count=$(getfattr -d -m. -e hex $B0/brick{0,1,2,3}/d 2>&1 | grep trusted.gfid | wc -l)
+EXPECT 4 echo $gfid_count
+cleanup;
diff --git a/tests/bugs/replicate/bug-1297695.t b/tests/bugs/replicate/bug-1297695.t
index d5c1a214fe2..e1fc960e6a7 100644
--- a/tests/bugs/replicate/bug-1297695.t
+++ b/tests/bugs/replicate/bug-1297695.t
@@ -39,5 +39,5 @@ write_to_file &
#Test if the MAX [F]INODELK fop latency is of the order of seconds.
EXPECT "^1$" get_pending_heal_count $V0
inodelk_max_latency=$($CLI volume profile $V0 info | grep INODELK | awk 'BEGIN {max = 0} {if ($6 > max) max=$6;} END {print max}' | cut -d. -f 1 | egrep "[0-9]{7,}")
-TEST [ -z $inodelk_max_latency ]
+EXPECT "^$" echo $inodelk_max_latency
cleanup
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 1c786d59d5b..dcbab2347b6 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -2548,12 +2548,16 @@ afr_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req)
if (xattr_req) {
/* If xattr_req was null, afr_lookup_xattr_req_prepare() will
allocate one for us */
- ret = dict_get_ptr (xattr_req, "gfid-req", &gfid_req);
+ local->xattr_req = dict_copy_with_ref (xattr_req, NULL);
+ if (!local->xattr_req) {
+ op_errno = ENOMEM;
+ goto out;
+ }
+ ret = dict_get_ptr (local->xattr_req, "gfid-req", &gfid_req);
if (ret == 0) {
gf_uuid_copy (local->cont.lookup.gfid_req, gfid_req);
- dict_del (xattr_req, "gfid-req");
+ dict_del (local->xattr_req, "gfid-req");
}
- local->xattr_req = dict_ref (xattr_req);
}
afr_read_subvol_get (loc->parent, this, NULL, &event,
diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c
index e32b81c46a4..6155298c7c6 100644
--- a/xlators/cluster/afr/src/afr-self-heal-name.c
+++ b/xlators/cluster/afr/src/afr-self-heal-name.c
@@ -88,11 +88,11 @@ __afr_selfheal_assign_gfid (xlator_t *this, inode_t *parent, uuid_t pargfid,
* __afr_selfheal_name_impunge().
*/
- afr_replies_wipe (replies, priv->child_count);
-
AFR_ONLIST (locked_on, new_frame, afr_selfheal_discover_cbk, lookup,
&loc, xdata);
+ afr_replies_wipe (replies, priv->child_count);
+
afr_replies_copy (replies, new_local->replies, priv->child_count);
out: