summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/fd.c
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-03-07 23:45:47 +0530
committerVijay Bellur <vijay@gluster.com>2012-03-07 10:39:50 -0800
commit8e29fe73b96f1feb3cc4093eb2e71c7c92be4a31 (patch)
treeeab794f7561207b67fa772da71acd461e01cb01d /libglusterfs/src/fd.c
parent63281d7eeb5b8ac44e3630ccfbc61774eedf2ae2 (diff)
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 <amarts@redhat.com> BUG: 787368 Reviewed-on: http://review.gluster.com/2892 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'libglusterfs/src/fd.c')
-rw-r--r--libglusterfs/src/fd.c8
1 files changed, 6 insertions, 2 deletions
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;
}