path: root/xlators/cluster/afr/src/afr-self-heal-entry.c
diff options
authorAnuradha Talur <>2015-07-03 11:35:46 +0530
committerPranith Kumar Karampuri <>2015-07-06 00:11:42 -0700
commit214101394bdea4ab57b8704467f450df4adbb8f6 (patch)
treeea39db8f455234764bd2f3aad85b825acad9495b /xlators/cluster/afr/src/afr-self-heal-entry.c
parent33935401cc548b55afc8ed907e54f72ff3e567b4 (diff)
cluster/afr : expunge first, impunge next in entry selfheal
When entry self-heals are performed, the files/directories that are to be expunged should be removed first and then impunge should be done. Consider the following scenario : A volume with 2 bricks : b0 and b1. 1) With following hierarchy on both bricks: olddir |__ oldfile 2) Bring down b1 and do 'mv olddir newdir'. 3) Bring up b1 and self-heal. 4) Without patch, during self-heal the events occur in following order, a) Creation of newdir on the sink brick. Notice that gfid of olddir and newdir are same. As a result of which gfid-link file in .glusterfs directory still points to olddir and not to newdir. b) Deletion of olddir on the sink brick. As a part of this deletion, the gfid link file is also deleted. Now, there is no link file pointing to newdir. 5) Files under newdir will not get listed as part of readdir. To tackle this kind of scenario, an expunge should be done first and impunge later; which is the purpose of this patch. Change-Id: Idc8546f652adf11a13784ff989077cf79986bbd5 BUG: 1238508 Signed-off-by: Anuradha Talur <> Reviewed-on: Reviewed-by: Ravishankar N <> Tested-by: Gluster Build System <> Reviewed-by: Krutika Dhananjay <> Reviewed-by: Pranith Kumar Karampuri <>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-entry.c')
1 files changed, 5 insertions, 2 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c
index ed89a859b2f..e2733063643 100644
--- a/xlators/cluster/afr/src/afr-self-heal-entry.c
+++ b/xlators/cluster/afr/src/afr-self-heal-entry.c
@@ -584,17 +584,20 @@ afr_selfheal_entry_do (call_frame_t *frame, xlator_t *this, fd_t *fd,
uuid_utoa (fd->inode->gfid));
for (i = 0; i < priv->child_count; i++) {
- if (i != source && !healed_sinks[i])
+ if (!healed_sinks[i])
ret = afr_selfheal_entry_do_subvol (frame, this, fd, i);
if (ret == -1) {
/* gfid or type mismatch. */
mismatch = _gf_true;
- continue;
+ ret = 0;
if (ret)
+ if (!ret && source != -1)
+ ret = afr_selfheal_entry_do_subvol (frame, this, fd, source);
if (mismatch == _gf_true)
/* undo pending will be skipped */
ret = -1;