diff options
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 5637de365e0..28abe2b87a0 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -665,6 +665,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; @@ -696,6 +697,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, @@ -721,6 +727,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) @@ -734,8 +743,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); |