summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshish Pandey <aspandey@redhat.com>2015-10-12 13:14:08 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-12-22 02:12:39 -0800
commit7223062cdc1934a6694265cfd73b9cc5a8c4f377 (patch)
tree71db1724249492a840658742c9178a1d6682a6ae
parent72176d439780afdb8b67de86182dd7444f1fb7d5 (diff)
cluster/afr : Remove stale indices
Change-Id: Iba23338a452b49dc9fe6ae7b4ca108ebc377fe42 BUG: 1283036 Signed-off-by: Ashish Pandey <aspandey@redhat.com> Reviewed-on: http://review.gluster.org/12336 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/12604 Tested-by: NetBSD Build System <jenkins@build.gluster.org>
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index f4896f125d4..651c7ee3326 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -59,6 +59,27 @@ afr_selfheal_post_op (call_frame_t *frame, xlator_t *this, inode_t *inode,
return 0;
}
+int
+afr_check_stale_error (struct afr_reply *replies, afr_private_t *priv)
+{
+ int i = 0;
+ int op_errno = 0;
+ int tmp_errno = 0;
+ int stale_count = 0;
+
+ for (i = 0; i < priv->child_count; i++) {
+ tmp_errno = replies[i].op_errno;
+ if (tmp_errno == ENOENT || tmp_errno == ESTALE) {
+ op_errno = afr_higher_errno (op_errno, tmp_errno);
+ stale_count++;
+ }
+ }
+ if (stale_count != priv->child_count)
+ return -ENOTCONN;
+ else
+ return -op_errno;
+}
+
dict_t *
afr_selfheal_output_xattr (xlator_t *this, afr_transaction_type type,
@@ -1215,7 +1236,7 @@ afr_selfheal_unlocked_inspect (call_frame_t *frame, xlator_t *this,
goto out;
}
} else if (valid_cnt < 2) {
- ret = -ENOTCONN;
+ ret = afr_check_stale_error (replies, priv);
goto out;
}