From 8e29fe73b96f1feb3cc4093eb2e71c7c92be4a31 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 7 Mar 2012 23:45:47 +0530 Subject: libglusterfs/fd: fixed fd_anonymous() leak fd was getting leaked whenever there was a overlapping operations, which caused memory leak, and process fd leaks, which made most of the operations on NFS mount of a replicate volume not work. With the fix, things are back to normal. Change-Id: I2d2158b2972ba5dae270d6ff7b1a827403653c04 Signed-off-by: Amar Tumballi BUG: 787368 Reviewed-on: http://review.gluster.com/2892 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- libglusterfs/src/fd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c index 60add299dd7..46b75cb1051 100644 --- a/libglusterfs/src/fd.c +++ b/libglusterfs/src/fd.c @@ -721,6 +721,10 @@ __fd_anonymous (inode_t *inode) fd = __fd_lookup (inode, (uint64_t)-1); + /* if (fd); then we already have increased the refcount in + __fd_lookup(), so no need of one more fd_ref(). + if (!fd); then both create and bind wont bump up the ref + count, so we have to call fd_ref() after bind. */ if (!fd) { fd = __fd_create (inode, (uint64_t)-1); @@ -728,9 +732,9 @@ __fd_anonymous (inode_t *inode) return NULL; __fd_bind (fd); - } - __fd_ref (fd); + __fd_ref (fd); + } return fd; } -- cgit