diff options
author | Susant Palai <spalai@redhat.com> | 2015-09-28 02:22:07 -0400 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2015-10-06 04:10:19 -0700 |
commit | 0d1be89fb2b2b9ad8bbc270069baf4dd64f8f017 (patch) | |
tree | 651afc8ee5abac8e57351a4ddc3b593edded6f8f /xlators/cluster | |
parent | c3dd76e9da783d879258cde17680f7d8747506f8 (diff) |
dht/rebalance: fix mem-leak in rebalance
Change-Id: I37faf983fc02996541f3d96a17cb2a2c2cdb6781
BUG: 1261234
Reviewed-on: http://review.gluster.org/12235
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Raghavendra G <rgowdapp@redhat.com>
Signed-off-by: Susant Palai <spalai@redhat.com>
Reviewed-on: http://review.gluster.org/12296
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/dht/src/dht-helper.c | 5 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 32 |
2 files changed, 32 insertions, 5 deletions
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index d68fa091c94..5a72db1176a 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -442,6 +442,11 @@ dht_local_wipe (xlator_t *this, dht_local_t *local) local->selfheal.layout = NULL; } + if (local->selfheal.refreshed_layout) { + dht_layout_unref (this, local->selfheal.refreshed_layout); + local->selfheal.refreshed_layout = NULL; + } + dht_lock_array_free (local->lock.locks, local->lock.lk_count); GF_FREE (local->lock.locks); diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index b817c57f90c..6471d54cdfe 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -50,6 +50,22 @@ } \ void +gf_defrag_free_container (struct dht_container *container) +{ + if (container) { + gf_dirent_entry_free (container->df_entry); + + if (container->parent_loc) { + loc_wipe (container->parent_loc); + } + + GF_FREE (container->parent_loc); + + GF_FREE (container); + } +} + +void dht_set_global_defrag_error (gf_defrag_info_t *defrag, int ret) { LOCK (&defrag->lock); @@ -1934,8 +1950,8 @@ gf_defrag_task (void *opaque) goto out; } - gf_dirent_free (iterator->df_entry); - GF_FREE (iterator); + gf_defrag_free_container (iterator); + continue; } else { @@ -2091,6 +2107,12 @@ gf_defrag_get_entry (xlator_t *this, int i, struct dht_container **container, gf_uuid_copy (entry_loc.pargfid, loc->gfid); entry_loc.inode->ia_type = df_entry->d_stat.ia_type; + + if (xattr_rsp) { + dict_unref (xattr_rsp); + xattr_rsp = NULL; + } + ret = syncop_lookup (conf->local_subvols[i], &entry_loc, &iatt, NULL, xattr_req, &xattr_rsp); if (ret) { @@ -2217,13 +2239,13 @@ gf_defrag_get_entry (xlator_t *this, int i, struct dht_container **container, } out: + loc_wipe (&entry_loc); + if (ret == 0) { *container = tmp_container; } else { if (tmp_container) { - GF_FREE (tmp_container->df_entry); - GF_FREE (tmp_container->parent_loc); - GF_FREE (tmp_container); + gf_defrag_free_container (tmp_container); } } |