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-common.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-common.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 54 |
1 files changed, 13 insertions, 41 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index f954b1399db..c31fcba6c3b 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -4617,14 +4617,10 @@ out: int32_t afr_heal_splitbrain_file(call_frame_t *frame, xlator_t *this, loc_t *loc) { - gf_boolean_t data_selfheal = _gf_false; - gf_boolean_t metadata_selfheal = _gf_false; - gf_boolean_t entry_selfheal = _gf_false; + int ret = 0; + int op_errno = 0; dict_t *dict = NULL; afr_local_t *local = NULL; - inode_t *inode = NULL; - int entry_ret = 0, metadata_ret = 0, data_ret = 0; - int ret = 0, op_errno = 0; local = frame->local; dict = dict_new (); @@ -4634,17 +4630,9 @@ afr_heal_splitbrain_file(call_frame_t *frame, xlator_t *this, loc_t *loc) goto out; } - ret = afr_selfheal_unlocked_inspect (frame, this, loc->gfid, &inode, - &data_selfheal, - &metadata_selfheal, - &entry_selfheal); - if (ret) { - op_errno = -ret; - ret = -1; - goto out; - } + ret = afr_selfheal_do (frame, this, loc->gfid); - if (!data_selfheal && !metadata_selfheal && !entry_selfheal) { + if (ret == 1) { ret = dict_set_str (dict, "sh-fail-msg", "File not in split-brain"); if (ret) @@ -4652,36 +4640,20 @@ afr_heal_splitbrain_file(call_frame_t *frame, xlator_t *this, loc_t *loc) "Failed to set sh-fail-msg in dict"); ret = 0; goto out; - } - - if (data_selfheal) - data_ret = afr_selfheal_data (frame, this, inode); - - if (metadata_selfheal) - metadata_ret = afr_selfheal_metadata (frame, this, inode); - - if (entry_selfheal) - entry_ret = afr_selfheal_entry (frame, this, inode); - - ret = (data_ret | metadata_ret | entry_ret); - - if (local->xdata_rsp) { - /* 'sh-fail-msg' has been set in the dict during self-heal.*/ - dict_copy (local->xdata_rsp, dict); - ret = 0; - } else if (ret) { - /*Some other error during self-heal. Just propagate it.*/ - op_errno = -ret; - ret = -1; + } else { + if (local->xdata_rsp) { + /* 'sh-fail-msg' has been set in the dict during self-heal.*/ + dict_copy (local->xdata_rsp, dict); + ret = 0; + } else if (ret < 0) { + op_errno = -ret; + ret = -1; + } } out: AFR_STACK_UNWIND (getxattr, frame, ret, op_errno, dict, NULL); if (dict) dict_unref(dict); - if (inode) { - inode_forget (inode, 1); - inode_unref (inode); - } return ret; } |