summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-dir-read.c
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-11-24 08:45:10 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-11-24 06:40:12 -0800
commit250edc9e494fe0c59eff580df18080111ecb475e (patch)
tree0e73af8f82f9f644abff21ee5b2f0309e276dc22 /xlators/cluster/afr/src/afr-dir-read.c
parent74612a456ad1602f8038fae79fee654eb427602a (diff)
cluster/afr: Refactored the self-heal interface.
Cleaned up the self-heal interface to callers. Signed-off-by: Vikas Gorur <vikas@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 170 (Auto-heal fails on files that are open()-ed/mmap()-ed) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=170
Diffstat (limited to 'xlators/cluster/afr/src/afr-dir-read.c')
-rw-r--r--xlators/cluster/afr/src/afr-dir-read.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-read.c b/xlators/cluster/afr/src/afr-dir-read.c
index ee80963b..24227c33 100644
--- a/xlators/cluster/afr/src/afr-dir-read.c
+++ b/xlators/cluster/afr/src/afr-dir-read.c
@@ -49,7 +49,7 @@
int
-afr_examine_dir_completion_cbk (call_frame_t *frame, xlator_t *this)
+afr_examine_dir_sh_unwind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_self_heal_t *sh = NULL;
@@ -98,8 +98,9 @@ afr_examine_dir_readdir_cbk (call_frame_t *frame, void *cookie,
xlator_t *this, int32_t op_ret, int32_t op_errno,
gf_dirent_t *entries)
{
- afr_private_t * priv = NULL;
- afr_local_t * local = NULL;
+ afr_private_t * priv = NULL;
+ afr_local_t * local = NULL;
+ afr_self_heal_t * sh = NULL;
gf_dirent_t * entry = NULL;
gf_dirent_t * tmp = NULL;
@@ -113,6 +114,7 @@ afr_examine_dir_readdir_cbk (call_frame_t *frame, void *cookie,
priv = this->private;
local = frame->local;
+ sh = &local->self_heal;
child_index = (long) cookie;
@@ -151,22 +153,23 @@ out:
if (__checksums_differ (local->cont.opendir.checksum,
priv->child_count)) {
- local->need_entry_self_heal = _gf_true;
- local->self_heal.forced_merge = _gf_true;
+ /* self-heal will call AFR_STACK_DESTROY and
+ thus unref local->fd, so ref it here */
- local->cont.lookup.buf.st_mode = local->fd->inode->st_mode;
+ local->fd = fd_ref (local->fd);
- local->child_count = afr_up_children_count (priv->child_count,
- local->child_up);
+ sh->need_entry_self_heal = _gf_true;
+ sh->forced_merge = _gf_true;
+ sh->mode = local->fd->inode->st_mode;
+ sh->background = _gf_false;
+ sh->unwind = afr_examine_dir_sh_unwind;
gf_log (this->name, GF_LOG_DEBUG,
"checksums of directory %s differ,"
" triggering forced merge",
local->loc.path);
- afr_self_heal (frame, this,
- afr_examine_dir_completion_cbk,
- _gf_true);
+ afr_self_heal (frame, this);
} else {
afr_set_opendir_done (this, local->fd->inode);