diff options
| author | Krutika Dhananjay <kdhananj@redhat.com> | 2014-09-18 14:36:38 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2014-09-20 01:56:06 -0700 | 
| commit | 999e9848d099f443a8bedbd1cd4678fe57dff11f (patch) | |
| tree | 2510f754fb1ceb17562f120840852d4cc826a063 | |
| parent | 10d45b9783b751c1f78b670281fd1d57ae377642 (diff) | |
cluster/dht: Fix dict_t leaks in rebalance process' execution path
        Backport of: http://review.gluster.org/8763
Two dict_t objects are leaked for every file migrated in success codepath.
It is the caller's responsibility to unref dict that it gets from calls to
syncop_getxattr(); and rebalance performs two syncop_getxattr()s per file
without freeing them.
Also, syncop_getxattr() on GF_XATTR_LINKINFO_KEY doesn't seem to be using
the response dict. Hence, NULL is now passed as opposed to @dict to
syncop_getxattr().
Change-Id: I48926389db965e006da151bf0ccb6bcaf3585199
BUG: 1144640
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/8785
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
| -rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 11 | 
1 files changed, 7 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index cd7f453b029..77ea6be112b 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -1443,6 +1443,12 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,                  free_entries = _gf_true;                  list_for_each_entry_safe (entry, tmp, &entries.list, list) { + +                        if (dict) { +                                dict_unref (dict); +                                dict = NULL; +                        } +                          if (defrag->defrag_status != GF_DEFRAG_STATUS_STARTED) {                                  ret = 1;                                  goto out; @@ -1549,9 +1555,6 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,                          uuid_str = NULL; -                        dict_del (dict, GF_XATTR_NODE_UUID_KEY); - -                          /* if distribute is present, it will honor this key.                           * -1, ENODATA is returned if distribute is not present                           * or file doesn't have a link-file. If file has @@ -1559,7 +1562,7 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,                           * and also that guarantees that file has to be mostly                           * migrated */ -                        ret = syncop_getxattr (this, &entry_loc, &dict, +                        ret = syncop_getxattr (this, &entry_loc, NULL,                                                 GF_XATTR_LINKINFO_KEY);                          if (ret < 0) {                                  if (-ret != ENODATA) {  | 
