From 24591071a3c6a4362b8bb6818f42d3b7ec176342 Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Wed, 7 Apr 2010 11:49:00 +0000 Subject: cluster/afr: Cleanup fd ctx in releasedir cbk Signed-off-by: Vijay Bellur Signed-off-by: Anand V. Avati BUG: 805 (memory leak in afr) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=805 --- xlators/cluster/afr/src/afr-dir-read.c | 1 + xlators/cluster/afr/src/afr.c | 18 +++++++++++++----- xlators/cluster/afr/src/afr.h | 3 +++ 3 files changed, 17 insertions(+), 5 deletions(-) (limited to 'xlators/cluster/afr/src') diff --git a/xlators/cluster/afr/src/afr-dir-read.c b/xlators/cluster/afr/src/afr-dir-read.c index cd2055776d5..5af168bf04e 100644 --- a/xlators/cluster/afr/src/afr-dir-read.c +++ b/xlators/cluster/afr/src/afr-dir-read.c @@ -724,6 +724,7 @@ int32_t afr_releasedir (xlator_t *this, fd_t *fd) { afr_forget_entries (fd); + afr_cleanup_fd_ctx (this, fd); return 0; } diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index 18cff07663c..f176ebe7944 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -1424,12 +1424,11 @@ out: int -afr_release (xlator_t *this, fd_t *fd) +afr_cleanup_fd_ctx (xlator_t *this, fd_t *fd) { - uint64_t ctx; - afr_fd_ctx_t * fd_ctx; - - int ret = 0; + uint64_t ctx = 0; + afr_fd_ctx_t *fd_ctx = NULL; + int ret = 0; ret = fd_ctx_get (fd, this, &ctx); @@ -1456,6 +1455,15 @@ out: } +int +afr_release (xlator_t *this, fd_t *fd) +{ + afr_cleanup_fd_ctx (this, fd); + + return 0; +} + + /* {{{ fsync */ int diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 589d5dffce3..a6ca1c2be9d 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -631,6 +631,9 @@ afr_is_opendir_done (xlator_t *this, inode_t *inode); void afr_local_transaction_cleanup (afr_local_t *local, xlator_t *this); +int +afr_cleanup_fd_ctx (xlator_t *this, fd_t *fd); + #define AFR_STACK_UNWIND(fop, frame, params ...) \ do { \ afr_local_t *__local = NULL; \ -- cgit