summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-08-26 12:59:47 +0530
committerKaleb KEITHLEY <kkeithle@redhat.com>2014-08-27 06:46:38 -0700
commitf0ddba7e0913db505f1295e9b3b7d35ead9c4407 (patch)
treead28e42375e834b0c5cb97a3e68000e187e4dd73 /xlators/cluster/afr
parent1679b72c5b023884fb4bc6a2a85b06016fb3cab8 (diff)
cluster/afr: Fix memory leak of file-path in self-heal-daemon
Backport of http://review.gluster.org/4790 Note: Only the part which fixes the memory leak is backported shd event has path which needs to be freed as part of circular buffer cleanup. This patch introduces the functionality so that self-heal-daemon can use it. Change-Id: I3f3823d5587eda2fcb278f0fdb89123a31c9d786 BUG: 1119894 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/8541 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Ravishankar N <ravishankar@redhat.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators/cluster/afr')
-rw-r--r--xlators/cluster/afr/src/afr-self-heald.c12
-rw-r--r--xlators/cluster/afr/src/afr.c9
-rw-r--r--xlators/cluster/afr/src/afr.h2
3 files changed, 20 insertions, 3 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
index 37bc224f58a..c5d7acbb685 100644
--- a/xlators/cluster/afr/src/afr-self-heald.c
+++ b/xlators/cluster/afr/src/afr-self-heald.c
@@ -65,6 +65,18 @@ afr_find_child_position (xlator_t *this, int child, afr_child_pos_t *pos);
int
afr_syncop_find_child_position (void *data);
+void
+_destroy_shd_event_data (void *data)
+{
+ shd_event_t *event = NULL;
+ if (!data)
+ goto out;
+ event = (shd_event_t*)data;
+ GF_FREE (event->path);
+out:
+ return;
+}
+
static int
_loc_assign_gfid_path (loc_t *loc)
{
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index d49a39d781c..70f74a22e2a 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -430,15 +430,18 @@ init (xlator_t *this)
if (!priv->shd.timer)
goto out;
- priv->shd.healed = eh_new (AFR_EH_HEALED_LIMIT, _gf_false);
+ priv->shd.healed = eh_new (AFR_EH_HEALED_LIMIT, _gf_false,
+ _destroy_shd_event_data);
if (!priv->shd.healed)
goto out;
- priv->shd.heal_failed = eh_new (AFR_EH_HEAL_FAIL_LIMIT, _gf_false);
+ priv->shd.heal_failed = eh_new (AFR_EH_HEAL_FAIL_LIMIT, _gf_false,
+ _destroy_shd_event_data);
if (!priv->shd.heal_failed)
goto out;
- priv->shd.split_brain = eh_new (AFR_EH_SPLIT_BRAIN_LIMIT, _gf_false);
+ priv->shd.split_brain = eh_new (AFR_EH_SPLIT_BRAIN_LIMIT, _gf_false,
+ _destroy_shd_event_data);
if (!priv->shd.split_brain)
goto out;
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index 84e8907f993..0a2b00168ea 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -1054,6 +1054,8 @@ afr_is_errno_unset (int *child_errno, int child);
gf_boolean_t
afr_is_fd_fixable (fd_t *fd);
+void _destroy_shd_event_data (void *data);
+
void
afr_prepare_new_entry_pending_matrix (int32_t **pending,
gf_boolean_t (*is_pending) (int *, int),