summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2013-12-26 11:31:49 +0530
committerVijay Bellur <vbellur@redhat.com>2014-01-27 09:17:38 -0800
commitcc1728766620e13ccfe2cd0b162cbc848b20e422 (patch)
tree8bb38fe14b21b796a1eb86cffa5ed1929080517d
parent0c80a202d475a4abb8a5738f144739234d7557c6 (diff)
cluster/afr: Treat ESTALE on nameless lookup as ENOENT
Change-Id: I635fc0fa955b33590f1c5b4dfec22d591ea8575c BUG: 1032894 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/6593 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--tests/bugs/bug-1032894.t34
-rw-r--r--tests/volume.rc5
-rw-r--r--xlators/cluster/afr/src/afr-common.c4
3 files changed, 42 insertions, 1 deletions
diff --git a/tests/bugs/bug-1032894.t b/tests/bugs/bug-1032894.t
new file mode 100644
index 0000000..2ac01d0
--- /dev/null
+++ b/tests/bugs/bug-1032894.t
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+
+#Check stale indices are deleted as part of self-heal-daemon crawl.
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
+TEST $CLI volume set $V0 cluster.self-heal-daemon off
+TEST $CLI volume start $V0
+TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0
+cd $M0
+TEST mkdir a
+cd a
+TEST kill_brick $V0 $H0 $B0/${V0}0
+# Create stale indices
+for i in {1..10}; do echo abc > $i; done
+for i in {1..10}; do rm -f $i; done
+
+TEST $CLI volume start $V0 force
+EXPECT_WITHIN 20 "1" afr_child_up_status_in_shd $V0 0
+TEST $CLI volume set $V0 cluster.self-heal-daemon on
+EXPECT_WITHIN 20 "Y" glustershd_up_status
+
+#Since maximum depth of the directory structure that needs healin is 2
+#Trigger two self-heals. That should make sure the heal is complete
+TEST $CLI volume heal $V0
+TEST $CLI volume heal $V0
+
+EXPECT_WITHIN 20 "0" afr_get_index_count $B0/${V0}1
+cleanup
diff --git a/tests/volume.rc b/tests/volume.rc
index 9871224..5fee3f4 100644
--- a/tests/volume.rc
+++ b/tests/volume.rc
@@ -177,6 +177,11 @@ function afr_get_pending_heal_count {
gluster volume heal $vol info | grep "Number of entries" | awk '{ sum+=$4} END {print sum}'
}
+function afr_get_index_count {
+ local brick=$1
+ ls $1/.glusterfs/indices/xattrop | grep -v xattrop | wc -l
+}
+
function afr_get_index_path {
local brick_path=$1
echo "$brick_path/.glusterfs/indices/xattrop"
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index af01f2e..acb6bc0 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -2184,7 +2184,9 @@ afr_resultant_errno_get (int32_t *children,
static void
afr_lookup_handle_error (afr_local_t *local, int32_t op_ret, int32_t op_errno)
{
- GF_ASSERT (local);
+ if ((local->loc.name == NULL) && (op_errno == ESTALE))
+ op_errno = ENOENT;
+
if (op_errno == ENOENT)
local->enoent_count++;