diff options
author | N Balachandran <nbalacha@redhat.com> | 2018-02-02 12:35:16 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2018-02-06 14:24:40 +0000 |
commit | 241a43b966ebdb599e27a154839d11d61aab1523 (patch) | |
tree | 01bf4af42dd2d3066a78ff22e5c464fbd0827e6d /xlators/cluster/dht/src/dht-common.c | |
parent | 2ef7410f00805b102689258a4063bb117b74158e (diff) |
cluster/dht: Fixed leak in dht_populate_inode_for_dentry
Fixed an issue in dht_populate_inode_for_dentry where a layout is
set in the inode without checking if it is already set. This overwrites
the value each time without freeing the already existing layout.
Also includes the changes in https://review.gluster.org/19471
which fix a leak introduced in the original patch.
> Change-Id: I651bf539a0b82b4ddc4c355890c16a8e91f5f1fd
> BUG: 1541264
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
Change-Id: I651bf539a0b82b4ddc4c355890c16a8e91f5f1fd
BUG: 1541277
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.c')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index d54d54c5fc4..2a076034997 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -6332,29 +6332,32 @@ dht_populate_inode_for_dentry (xlator_t *this, xlator_t *subvol, int ret = 0; loc_t loc = {0, }; + gf_uuid_copy (loc.gfid, orig_entry->d_stat.ia_gfid); + loc.inode = inode_ref (orig_entry->inode); + + if (is_revalidate (&loc)) { + goto out; + } + layout = dht_layout_new (this, 1); if (!layout) goto out; ret = dht_layout_merge (this, layout, subvol, 0, 0, orig_entry->dict); if (!ret) { - gf_uuid_copy (loc.gfid, orig_entry->d_stat.ia_gfid); - loc.inode = inode_ref (orig_entry->inode); - ret = dht_layout_normalize (this, &loc, layout); if (ret == 0) { dht_layout_set (this, orig_entry->inode, layout); entry->inode = inode_ref (orig_entry->inode); layout = NULL; } - - loc_wipe (&loc); } if (layout) dht_layout_unref (this, layout); out: + loc_wipe (&loc); return; } @@ -6502,6 +6505,7 @@ list: entry, orig_entry); } + } } else { if (orig_entry->inode) { |