summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heal-entry.c
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-10-23 06:44:46 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-23 05:54:53 -0700
commit58efcf03a63324b7bbfda864647d35256917058a (patch)
treef5bb0ae514e0734fdf07d8e2920ad35fe565d592 /xlators/cluster/afr/src/afr-self-heal-entry.c
parentdfa1f5755b11d11c81cbbdd79dcb5b3f8d216ac9 (diff)
cluster/afr: Prevent spurious entry self-heal.
If the initial lookup shows that 'pending' is positive, then self-heal will hold a lock and do a lookup again. This lookup might show that 'pending' is zero everywhere. However, entry self-heal used to consider this as a case of 'no sources' and try to merge the directories. This patch checks for that case and does not do the merge. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 326 ([2.0.8rc9] Spurious self-heal) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=326
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-entry.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-entry.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c
index 1374b1c5bf9..cf7bf9a9c0d 100644
--- a/xlators/cluster/afr/src/afr-self-heal-entry.c
+++ b/xlators/cluster/afr/src/afr-self-heal-entry.c
@@ -1948,6 +1948,8 @@ afr_sh_entry_fix (call_frame_t *frame, xlator_t *this)
afr_private_t *priv = NULL;
int source = 0;
+ int nsources = 0;
+
local = frame->local;
sh = &local->self_heal;
priv = this->private;
@@ -1957,8 +1959,17 @@ afr_sh_entry_fix (call_frame_t *frame, xlator_t *this)
afr_sh_print_pending_matrix (sh->pending_matrix, this);
- afr_sh_mark_sources (sh, priv->child_count,
- AFR_SELF_HEAL_ENTRY);
+ nsources = afr_sh_mark_sources (sh, priv->child_count,
+ AFR_SELF_HEAL_ENTRY);
+
+ if (nsources == 0) {
+ gf_log (this->name, GF_LOG_TRACE,
+ "No self-heal needed for %s",
+ local->loc.path);
+
+ afr_sh_entry_finish (frame, this);
+ return 0;
+ }
afr_sh_supress_errenous_children (sh->sources, sh->child_errno,
priv->child_count);