summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heal-name.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2018-08-27 12:40:16 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2018-09-21 13:27:00 +0000
commita642f594a00e943e1fa1e121a3f4d331fed1c70b (patch)
treed5427e91bf3067f0046ffd51e61d174d23d9e2a1 /xlators/cluster/afr/src/afr-self-heal-name.c
parent00dae0e2ea1260a082af33dac5b06ca6aa68ccc3 (diff)
cluster/afr: Delegate name-heal when possible
Problem: When name-self-heal is triggered on the mount, it blocks lookup until name-self-heal completes. But that can lead to hangs when lot of clients are accessing a directory which needs name heal and all of them trigger heals waiting for other clients to complete heal. Fix: When a name-heal is needed but quorum number of names have the file and pending xattrs exist on the parent, then better to delegate the heal to SHD which will be completed as part of entry-heal of the parent directory. We could also do the same for quorum-number of names not present but we don't have any known use-case where this is a frequent occurrence so not changing that part at the moment. When there is a gfid mismatch or missing gfid it is important to complete the heal so that next rename doesn't assume everything is fine and perform a rename etc fixes bz#1625575 Change-Id: I8b002c85dffc6eb6f2833e742684a233daefeb2c Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-name.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-name.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c
index bcd0e60c947..0a5be29d5ee 100644
--- a/xlators/cluster/afr/src/afr-self-heal-name.c
+++ b/xlators/cluster/afr/src/afr-self-heal-name.c
@@ -634,20 +634,26 @@ afr_selfheal_name_unlocked_inspect (call_frame_t *frame, xlator_t *this,
continue;
if ((replies[i].op_ret == -1) &&
- (replies[i].op_errno == ENODATA))
+ (replies[i].op_errno == ENODATA)) {
*need_heal = _gf_true;
+ break;
+ }
if (first_idx == -1) {
first_idx = i;
continue;
}
- if (replies[i].op_ret != replies[first_idx].op_ret)
+ if (replies[i].op_ret != replies[first_idx].op_ret) {
*need_heal = _gf_true;
+ break;
+ }
if (gf_uuid_compare (replies[i].poststat.ia_gfid,
- replies[first_idx].poststat.ia_gfid))
+ replies[first_idx].poststat.ia_gfid)) {
*need_heal = _gf_true;
+ break;
+ }
}
if (inode)