diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2015-02-19 19:35:17 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-03-04 16:37:56 -0800 |
commit | 4a8384fe76aeef652554c48df737d3178eb0160c (patch) | |
tree | ac00907a88517c7ad4e23ff7af516de08752422a /xlators/cluster/afr/src/afr-self-heal-data.c | |
parent | a42db19a5dd796f5387b0765f5fc05cef462df22 (diff) |
cluster/afr: Do not increment healed_count if no healing was performed
PROBLEM:
When file modifications are happening while index heal is launched,
index healer could pick up entries which appeared in indices/xattrop
transiently during the course of the operations on the mount point, and
do not really need any heal. This will cause index healer to keep doing
index-heal in a loop as long as it finds this entry, by believing that
it did successfully heal some gfids even when it didn't.
FIX:
afr_selfheal() now returns a 1 to indicate that it did not (need to)
heal a given gfid. afr_shd_selfheal() will not increment healed_count
whenever afr_selfheal() returns a 1.
Change-Id: I0d97e11392a032a852e8c6508f691300ef0e5b98
BUG: 1194305
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/9713
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Ravishankar N <ravishankar@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-data.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-data.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 1b1d57d0048..c0f444a776e 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -645,6 +645,7 @@ __afr_selfheal_data (call_frame_t *frame, xlator_t *this, fd_t *fd, struct afr_reply *locked_replies = NULL; int source = -1; gf_boolean_t compat = _gf_false; + gf_boolean_t did_sh = _gf_true; unsigned char *compat_lock = NULL; priv = this->private; @@ -676,6 +677,11 @@ __afr_selfheal_data (call_frame_t *frame, xlator_t *this, fd_t *fd, if (ret < 0) goto unlock; + if (AFR_COUNT(healed_sinks, priv->child_count) == 0) { + did_sh = _gf_false; + goto unlock; + } + source = ret; ret = __afr_selfheal_truncate_sinks (frame, this, fd, healed_sinks, @@ -701,6 +707,9 @@ unlock: if (ret < 0) goto out; + if (!did_sh) + goto out; + ret = afr_selfheal_data_do (frame, this, fd, source, healed_sinks, locked_replies); if (ret) @@ -714,8 +723,11 @@ out: afr_selfheal_uninodelk (frame, this, fd->inode, this->name, LLONG_MAX - 2, 1, compat_lock); - afr_log_selfheal (fd->inode->gfid, this, ret, "data", source, - healed_sinks); + if (did_sh) + afr_log_selfheal (fd->inode->gfid, this, ret, "data", source, + healed_sinks); + else + ret = 1; if (locked_replies) afr_replies_wipe (locked_replies, priv->child_count); |