summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorN Balachandran <nbalacha@redhat.com>2018-02-02 12:35:16 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2018-02-02 12:22:47 +0000
commitd9f773ba719397c12860f494a8cd38109e4b2fe3 (patch)
tree006dfbecf4862a093fee4398ff8417a44b510c6b
parent641e5be8d1bcbb5161487eeb84229eed5ee5c31b (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. Change-Id: I651bf539a0b82b4ddc4c355890c16a8e91f5f1fd BUG: 1541264 Signed-off-by: N Balachandran <nbalacha@redhat.com>
-rw-r--r--xlators/cluster/dht/src/dht-common.c12
-rw-r--r--xlators/cluster/dht/src/dht-common.h2
2 files changed, 10 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 36ee3eeb8c5..ec6e3d857c1 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -6337,15 +6337,20 @@ dht_populate_inode_for_dentry (xlator_t *this, xlator_t *subvol,
return;
}
+ gf_uuid_copy (loc.gfid, orig_entry->d_stat.ia_gfid);
+ loc.inode = inode_ref (orig_entry->inode);
+
+ if (is_revalidate (&loc)) {
+ loc_wipe (&loc);
+ return;
+ }
+
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);
@@ -6507,6 +6512,7 @@ list:
entry,
orig_entry);
}
+
}
} else {
if (orig_entry->inode) {
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h
index a4114adc1de..91ba3418643 100644
--- a/xlators/cluster/dht/src/dht-common.h
+++ b/xlators/cluster/dht/src/dht-common.h
@@ -751,7 +751,7 @@ typedef struct dht_fd_ctx {
#define ENTRY_MISSING(op_ret, op_errno) (op_ret == -1 && op_errno == ENOENT)
-#define is_revalidate(loc) (dht_inode_ctx_layout_get (loc->inode, this, NULL) == 0)
+#define is_revalidate(loc) (dht_inode_ctx_layout_get ((loc)->inode, this, NULL) == 0)
#define is_last_call(cnt) (cnt == 0)