From c7fbb78ec198968069821cb0769071d17df1c58b Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Wed, 16 Jul 2014 15:03:19 +0530 Subject: cluster/afr: Fix leaks in self-heal code path Change-Id: I5301ec9ebac27afe52e85cad75e6395d7f891355 BUG: 1120151 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/8316 Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi Reviewed-by: Ravishankar N Reviewed-by: Niels de Vos --- xlators/cluster/afr/src/afr-self-heal-metadata.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'xlators/cluster/afr/src/afr-self-heal-metadata.c') diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c index 6cefc8d0fb0..9b64f07764e 100644 --- a/xlators/cluster/afr/src/afr-self-heal-metadata.c +++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c @@ -180,13 +180,8 @@ afr_sh_metadata_sync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, call_count = afr_frame_return (frame); - if (call_count == 0) { - if (local->xattr_req) { - dict_unref (local->xattr_req); - local->xattr_req = NULL; - } + if (call_count == 0) afr_sh_metadata_erase_pending (frame, this); - } return 0; } @@ -220,6 +215,7 @@ afr_sh_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int i = 0; afr_private_t *priv = NULL; afr_local_t *local = NULL; + afr_self_heal_t *sh = NULL; priv = this->private; local = frame->local; @@ -231,12 +227,13 @@ afr_sh_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } i = (long) cookie; + sh = &local->self_heal; STACK_WIND_COOKIE (frame, afr_sh_metadata_xattr_cbk, (void *) (long) i, priv->children[i], priv->children[i]->fops->setxattr, - &local->loc, local->xattr_req, 0, NULL); + &local->loc, sh->heal_xattr, 0, NULL); out: return 0; @@ -319,7 +316,7 @@ afr_sh_metadata_sync (call_frame_t *frame, xlator_t *this, dict_t *xattr) */ if (xattr) { call_count = active_sinks * 2; - local->xattr_req = dict_ref (xattr); + sh->heal_xattr = dict_ref (xattr); } else call_count = active_sinks; -- cgit