summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-07-16 15:03:19 +0530
committerNiels de Vos <ndevos@redhat.com>2014-07-18 03:28:22 -0700
commitc7fbb78ec198968069821cb0769071d17df1c58b (patch)
tree299f07d9050b789ff49477d45335aeb263820dff /xlators
parentaf82523251f4fa35afe6bd2da5d0391da7635fed (diff)
cluster/afr: Fix leaks in self-heal code path
Change-Id: I5301ec9ebac27afe52e85cad75e6395d7f891355 BUG: 1120151 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/8316 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-by: Ravishankar N <ravishankar@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/afr/src/afr-common.c3
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-data.c3
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-metadata.c13
-rw-r--r--xlators/cluster/afr/src/afr-self-heald.c3
-rw-r--r--xlators/cluster/afr/src/afr.h1
5 files changed, 15 insertions, 8 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 2f9913152d4..4ca81e81dae 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -833,6 +833,9 @@ afr_local_sh_cleanup (afr_local_t *local, xlator_t *this)
GF_FREE (sh->write_needed);
if (sh->healing_fd)
fd_unref (sh->healing_fd);
+
+ if (sh->heal_xattr)
+ dict_unref (sh->heal_xattr);
}
diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c
index 6c895dbde5d..08983e66f20 100644
--- a/xlators/cluster/afr/src/afr-self-heal-data.c
+++ b/xlators/cluster/afr/src/afr-self-heal-data.c
@@ -918,6 +918,9 @@ afr_set_data_sh_info_str (afr_local_t *local, afr_self_heal_t *sh, xlator_t *thi
if (sizes_str && strcmp (sizes_str, ""))
GF_FREE (sizes_str);
+
+ if (sinks_str && strcmp (sinks_str, ""))
+ GF_FREE (sinks_str);
}
void
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;
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
index dfa91d78501..c35ce359911 100644
--- a/xlators/cluster/afr/src/afr-self-heald.c
+++ b/xlators/cluster/afr/src/afr-self-heald.c
@@ -1498,6 +1498,9 @@ out:
if (ret)
*pos = AFR_POS_UNKNOWN;
loc_wipe (&loc);
+ if (xattr_rsp)
+ dict_unref (xattr_rsp);
+
return ret;
}
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index af57d8b0eff..1bca07c0768 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -254,6 +254,7 @@ struct afr_self_heal_ {
/* array of xattr's, one for each child */
dict_t **xattr;
+ dict_t *heal_xattr;
/* array containing if the lookups succeeded in the order of response
*/
int32_t *success_children;