From 8c86febc41816730c9fd44fd87cefe3ef330d072 Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Thu, 22 Oct 2009 06:36:22 +0000 Subject: cluster/afr: entry self-heal: Store parent_loc on the heap for impunge_parent_setattr. Signed-off-by: Anand V. Avati 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 --- xlators/cluster/afr/src/afr-self-heal-entry.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'xlators/cluster/afr') diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c index 579915f78..1374b1c5b 100644 --- a/xlators/cluster/afr/src/afr-self-heal-entry.c +++ b/xlators/cluster/afr/src/afr-self-heal-entry.c @@ -1092,12 +1092,16 @@ afr_sh_entry_impunge_parent_setattr_cbk (call_frame_t *setattr_frame, { loc_t *parent_loc = cookie; - gf_log (this->name, GF_LOG_DEBUG, - "setattr on directory %s failed: %s", - parent_loc->path, strerror (op_errno)); + if (op_ret != 0) { + gf_log (this->name, GF_LOG_DEBUG, + "setattr on parent directory failed: %s", + strerror (op_errno)); + } loc_wipe (parent_loc); + FREE (parent_loc); + AFR_STACK_DESTROY (setattr_frame); return 0; } @@ -1126,8 +1130,8 @@ afr_sh_entry_impunge_newfile_cbk (call_frame_t *impunge_frame, void *cookie, afr_self_heal_t *sh = NULL; call_frame_t *setattr_frame = NULL; - loc_t parent_loc; int32_t valid = 0; + loc_t *parent_loc = NULL; struct stat parentbuf; priv = this->private; @@ -1169,7 +1173,8 @@ afr_sh_entry_impunge_newfile_cbk (call_frame_t *impunge_frame, void *cookie, parentbuf = impunge_sh->parentbuf; setattr_frame = copy_frame (impunge_frame); - afr_build_parent_loc (&parent_loc, &impunge_local->loc); + parent_loc = CALLOC (1, sizeof (*parent_loc)); + afr_build_parent_loc (parent_loc, &impunge_local->loc); STACK_WIND_COOKIE (impunge_frame, afr_sh_entry_impunge_xattrop_cbk, (void *) (long) child_index, @@ -1178,10 +1183,10 @@ afr_sh_entry_impunge_newfile_cbk (call_frame_t *impunge_frame, void *cookie, &impunge_local->loc, GF_XATTROP_ADD_ARRAY, xattr); STACK_WIND_COOKIE (setattr_frame, afr_sh_entry_impunge_parent_setattr_cbk, - (void *) (long) &parent_loc, + (void *) (long) parent_loc, priv->children[child_index], priv->children[child_index]->fops->setattr, - &parent_loc, &parentbuf, valid); + parent_loc, &parentbuf, valid); dict_unref (xattr); -- cgit