diff options
author | Vikas Gorur <vikas@gluster.com> | 2009-11-12 08:44:16 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-11-13 02:13:43 -0800 |
commit | 26fbaa23cafee4643b7604660762656c4a71684b (patch) | |
tree | 90bef7f03cb305dad016439706d46fdd0ed84f62 /xlators/cluster/afr/src/afr-self-heal-common.c | |
parent | 4717e5279e169a36a870a267039e788cf22602a8 (diff) |
cluster/afr: Ensure directory contents are in sync during opendir.
The problem: If some files on the first subvolume disappeared
without leaving a trace in the entry changelog (this can happen,
for example, when an fsck has deleted files or when a hard drive
is replaced), those files would never be self-healed even though
they would be present on the second subvolume. This is because
readdir is sent only to the first subvolume, and since the files
don't appear in the directory listing, no lookup would ever be
sent on them.
This patch fixes this problem by doing a readdir on all the subvolumes
during the first opendir on a directory inode. If a discrepancy in the
contents is detected, entry self-heal in a special "force merge" mode
is triggered on that directory.
Signed-off-by: Vikas Gorur <vikas@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 249 (Self heal of a file that does not exist on the first subvolume)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=249
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-common.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-common.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index b23eea391..8142bdf1d 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -1382,10 +1382,12 @@ afr_local_t *afr_local_copy (afr_local_t *l, xlator_t *this) loc_copy (&lc->loc, &l->loc); lc->child_up = memdup (l->child_up, priv->child_count); - lc->xattr_req = dict_copy_with_ref (l->xattr_req, NULL); + if (l->xattr_req) + lc->xattr_req = dict_copy_with_ref (l->xattr_req, NULL); lc->cont.lookup.inode = l->cont.lookup.inode; - lc->cont.lookup.xattr = dict_copy_with_ref (l->cont.lookup.xattr, NULL); + if (l->cont.lookup.xattr) + lc->cont.lookup.xattr = dict_copy_with_ref (l->cont.lookup.xattr, NULL); return lc; } @@ -1502,7 +1504,12 @@ afr_self_heal (call_frame_t *frame, xlator_t *this, sh->background = _gf_true; sh->orig_frame = frame; - sh->completion_cbk = afr_bgsh_completion_cbk; + + if (completion_cbk == NULL) + sh->completion_cbk = afr_bgsh_completion_cbk; + else + sh->completion_cbk = completion_cbk; + sh->unwind = afr_bgsh_unwind; sh->buf = CALLOC (priv->child_count, sizeof (struct stat)); |