diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2014-09-13 12:08:56 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2014-09-24 01:51:35 -0700 |
commit | 70d76f20ee127fe7e8e52b2d67e2362283a01f34 (patch) | |
tree | a0bd58a4f86dbe26763dc6b008818eac7e190e40 /xlators/cluster/afr/src/afr-self-heal-metadata.c | |
parent | bd592f8b8379087604f35c3b377f6e94b9e1697d (diff) |
cluster/afr: Fix spurious metadata self-heals
- Added logging for metadata and data self-heals which helped
in debugging this issue.
- Added checks to skip self-heals when no sinks are available to heal
Change-Id: I0d50dceb84cd9ad4fe00e0b749ddf7d4ff42348a
BUG: 1128721
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/8709
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-metadata.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-metadata.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c index 2c5f3fd652c..5b9e290e49a 100644 --- a/xlators/cluster/afr/src/afr-self-heal-metadata.c +++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c @@ -97,7 +97,6 @@ __afr_selfheal_metadata_finalize_source (call_frame_t *frame, xlator_t *this, struct iatt first = {0, }; int source = -1; int sources_count = 0; - int ret = 0; priv = this->private; @@ -136,6 +135,10 @@ __afr_selfheal_metadata_finalize_source (call_frame_t *frame, xlator_t *this, !IA_EQUAL (first, replies[i].poststat, uid) || !IA_EQUAL (first, replies[i].poststat, gid) || !IA_EQUAL (first, replies[i].poststat, prot)) { + gf_log (this->name, GF_LOG_DEBUG, "%s: iatt mismatch " + "for source(%d) vs (%d)", + uuid_utoa (replies[source].poststat.ia_gfid), + source, i); sources[i] = 0; healed_sinks[i] = 1; } @@ -144,14 +147,12 @@ __afr_selfheal_metadata_finalize_source (call_frame_t *frame, xlator_t *this, for (i =0; i < priv->child_count; i++) { if (!sources[i] || i == source) continue; - if (replies[source].xdata->count != replies[i].xdata->count) { - sources[i] = 0; - healed_sinks[i] = 1; - continue; - } - ret = dict_foreach(replies[source].xdata, xattr_is_equal, - (void*)replies[i].xdata); - if (ret == -1) { + if (!afr_xattrs_are_equal (replies[source].xdata, + replies[i].xdata)) { + gf_log (this->name, GF_LOG_DEBUG, "%s: xattr mismatch " + "for source(%d) vs (%d)", + uuid_utoa (replies[source].poststat.ia_gfid), + source, i); sources[i] = 0; healed_sinks[i] = 1; } @@ -241,6 +242,12 @@ __afr_selfheal_metadata (call_frame_t *frame, xlator_t *this, inode_t *inode, goto unlock; source = ret; + + if (AFR_COUNT (healed_sinks, priv->child_count) == 0) { + ret = -ENOTCONN; + goto unlock; + } + ret = __afr_selfheal_metadata_do (frame, this, inode, source, healed_sinks, locked_replies); if (ret) @@ -254,6 +261,10 @@ __afr_selfheal_metadata (call_frame_t *frame, xlator_t *this, inode_t *inode, unlock: afr_selfheal_uninodelk (frame, this, inode, this->name, LLONG_MAX -1, 0, data_lock); + + afr_log_selfheal (inode->gfid, this, ret, "metadata", source, + healed_sinks); + if (locked_replies) afr_replies_wipe (locked_replies, priv->child_count); return ret; |