diff options
author | Vikas Gorur <vikas@gluster.com> | 2009-12-07 05:44:31 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-12-07 05:31:37 -0800 |
commit | a12bfdc8f32212354824a1b8dd7b27840518c4dc (patch) | |
tree | 4a163a15206ebe42e1fa6bbb466cd5ade6e4043c /xlators/cluster/afr | |
parent | 0ae2b4be39214426a50f5e1fd09562f309819f32 (diff) |
cluster/afr: Sync the parent directory's mtime during missing entries self-heal.
Signed-off-by: Vikas Gorur <vikas@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 137 (Parent directory mtime not reset after a create in self-heal)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=137
Diffstat (limited to 'xlators/cluster/afr')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-common.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index a0e19210ae7..fe48660c071 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -834,6 +834,8 @@ sh_destroy_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { afr_local_t *local = NULL; + loc_t *parent_loc = cookie; + int call_count = 0; local = frame->local; @@ -844,6 +846,11 @@ sh_destroy_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->loc.path, strerror (op_errno)); } + if (parent_loc) { + loc_wipe (parent_loc); + FREE (parent_loc); + } + call_count = afr_frame_return (frame); if (call_count == 0) { @@ -869,6 +876,8 @@ sh_missing_entries_newentry_cbk (call_frame_t *frame, void *cookie, int call_count = 0; int child_index = 0; + loc_t *parent_loc = NULL; + struct stat stbuf; int32_t valid; @@ -901,16 +910,27 @@ sh_missing_entries_newentry_cbk (call_frame_t *frame, void *cookie, setattr_frame->local = CALLOC (1, sizeof (afr_local_t)); - ((afr_local_t *)setattr_frame->local)->call_count = 1; + ((afr_local_t *)setattr_frame->local)->call_count = 2; gf_log (this->name, GF_LOG_TRACE, "setattr (%s) on subvolume %s", local->loc.path, priv->children[child_index]->name); - STACK_WIND (setattr_frame, sh_destroy_cbk, - priv->children[child_index], - priv->children[child_index]->fops->setattr, - &local->loc, &stbuf, valid); + STACK_WIND_COOKIE (setattr_frame, sh_destroy_cbk, + (void *) (long) 0, + priv->children[child_index], + priv->children[child_index]->fops->setattr, + &local->loc, &stbuf, valid); + + valid = GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME; + parent_loc = CALLOC (1, sizeof (*parent_loc)); + afr_build_parent_loc (parent_loc, &local->loc); + + STACK_WIND_COOKIE (setattr_frame, sh_destroy_cbk, + (void *) (long) parent_loc, + priv->children[child_index], + priv->children[child_index]->fops->setattr, + parent_loc, &sh->parentbuf, valid); } call_count = afr_frame_return (frame); @@ -1224,7 +1244,7 @@ sh_missing_entries_lookup_cbk (call_frame_t *frame, void *cookie, buf->st_mode); local->self_heal.buf[child_index] = *buf; - + local->self_heal.parentbuf = *postparent; } else { gf_log (this->name, GF_LOG_TRACE, "path %s on subvolume %s => -1 (%s)", |