summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/bugs/fb8149516.t17
-rw-r--r--xlators/cluster/afr/src/afr-common.c7
2 files changed, 17 insertions, 7 deletions
diff --git a/tests/bugs/fb8149516.t b/tests/bugs/fb8149516.t
index 54372794c6f..3679ab8f93a 100644
--- a/tests/bugs/fb8149516.t
+++ b/tests/bugs/fb8149516.t
@@ -16,6 +16,8 @@ TEST $CLI volume set $V0 cluster.entry-self-heal off
TEST $CLI volume set $V0 cluster.data-self-heal off
TEST $CLI volume set $V0 cluster.metadata-self-heal off
TEST $CLI volume set $V0 nfs.disable off
+TEST $CLI volume set $V0 nfs.write-size 524288
+TEST $CLI volume set $V0 nfs.read-size 524288
TEST $CLI volume start $V0
TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0
cd $M0
@@ -28,13 +30,20 @@ TEST kill_brick $V0 $H0 $B0/${V0}2
TEST rm -rf $B0/${V0}2/testfile*
TEST rm -rf $B0/${V0}2/.glusterfs
-TEST $CLI volume start $V0 force
+TEST $CLI volume stop $V0
+sleep 5
+TEST $CLI volume start $V0
EXPECT_WITHIN 20 "1" afr_child_up_status_in_shd $V0 2
+EXPECT_WITHIN 30 "0" get_pending_heal_count $V0
# Verify we see all ten files when ls'ing, without the patch this should
# return no files and fail.
-FILE_LIST=($(\ls $M0))
-TEST "((${#FILE_LIST[@]} == 10))"
-EXPECT_WITHIN 30 "0" get_pending_heal_count $V0
+how_many_files () {
+ \ls $M0 2> /dev/null | wc -l
+}
+# Once it's triggered, entry self-heal happens asynchronously and might take
+# a long-ish time before the missing entries appear, but it does complete.
+# To accommodate that, retry for a little while.
+EXPECT_WITHIN 20 "10" how_many_files
cleanup
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 06860448fc5..94f43f008a5 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -1100,15 +1100,16 @@ afr_inode_refresh_done (call_frame_t *frame, xlator_t *this, int error)
}
local = frame->local;
- priv = this->private;
+ priv = this->private;
ret = afr_replies_interpret (frame, this, local->refreshinode,
&start_heal);
err = afr_inode_refresh_err (frame, this);
- if (priv->did_discovery == _gf_false ||
- (afr_selfheal_enabled (this) && start_heal)) {
+ if ((ret && afr_selfheal_enabled (this)) ||
+ (priv->did_discovery == _gf_false &&
+ AFR_IS_ROOT_GFID (local->refreshinode->gfid))) {
heal_frame = copy_frame (frame);
if (!heal_frame)
goto refresh_done;