summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2013-03-25 20:34:43 -0700
committerAnand Avati <avati@redhat.com>2013-03-28 19:50:57 -0700
commit0b81f2801b7a72130d86c88da938f288430cd3e5 (patch)
tree60060bf5e42a8a9d661eb59ca6b81cddb04f1cae /xlators/cluster
parent6ae6f3db02ec374448e9286b03651849ae30dff0 (diff)
cluster/afr: fix fd leak with unsafe call_resume()
Introduce AFR_CALL_RESUME macro which cleans up frame->local, like how AFR_STACK_UNWIND etc. do. Therefore fix leak in afr_fsync() path. Change-Id: I3855d8e7e84dbc44e05f507563b7f722bf9621b8 BUG: 927146 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/4745 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c2
-rw-r--r--xlators/cluster/afr/src/afr.h16
2 files changed, 17 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index e54f9c2cbec..e766b65cdc8 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -399,7 +399,7 @@ afr_changelog_post_op_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (call_count == 0) {
if (local->transaction.resume_stub) {
- call_resume (local->transaction.resume_stub);
+ AFR_CALL_RESUME (local->transaction.resume_stub);
local->transaction.resume_stub = NULL;
}
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index 878dbd7ba9d..24bd20f136b 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -923,6 +923,22 @@ afr_launch_openfd_self_heal (call_frame_t *frame, xlator_t *this, fd_t *fd);
} \
} while (0);
+#define AFR_CALL_RESUME(stub) \
+ do { \
+ afr_local_t *__local = NULL; \
+ xlator_t *__this = NULL; \
+ \
+ __local = stub->frame->local; \
+ __this = stub->frame->this; \
+ stub->frame->local = NULL; \
+ \
+ call_resume (stub); \
+ if (__local) { \
+ afr_local_cleanup (__local, __this); \
+ mem_put (__local); \
+ } \
+ } while (0)
+
#define AFR_NUM_CHANGE_LOGS 3 /*data + metadata + entry*/
/* allocate and return a string that is the basename of argument */
static inline char *