diff options
author | Anuradha Talur <atalur@redhat.com> | 2015-07-03 11:35:46 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-07-06 00:11:42 -0700 |
commit | 214101394bdea4ab57b8704467f450df4adbb8f6 (patch) | |
tree | ea39db8f455234764bd2f3aad85b825acad9495b /xlators/cluster | |
parent | 33935401cc548b55afc8ed907e54f72ff3e567b4 (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 <atalur@redhat.com>
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>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-entry.c | 7 |
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]) 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; |