summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAnuradha Talur <atalur@redhat.com>2015-07-03 11:35:46 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-07-27 00:29:10 -0700
commit93d8634dec1bef5fd80f8ee28a4e4e0b8115afdd (patch)
tree8602d1baf1722359e7bb86ca706a2da62aabd286 /xlators
parent73517fedf7840363b9f688183e604a617d934652 (diff)
cluster/afr : expunge first, impunge next in entry selfheal
Backport of: http://review.gluster.org/11498 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: 1240183 Reviewed-on: http://review.gluster.org/11498 Reviewed-by: Ravishankar N <ravishankar@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Signed-off-by: Anuradha Talur <atalur@redhat.com> Reviewed-on: http://review.gluster.org/11544 Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-entry.c7
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 146c743c67d..e06e43eb828 100644
--- a/xlators/cluster/afr/src/afr-self-heal-entry.c
+++ b/xlators/cluster/afr/src/afr-self-heal-entry.c
@@ -589,17 +589,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])
continue;
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)
break;
}
+ 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;