|
|
d1681e |
From 47678bde5c2f8e674289d2b0893865ab3fa43940 Mon Sep 17 00:00:00 2001
|
|
|
d1681e |
From: Atin Mukherjee <amukherj@redhat.com>
|
|
|
d1681e |
Date: Sun, 1 Apr 2018 10:10:41 +0530
|
|
|
d1681e |
Subject: [PATCH 207/212] glusterd: fix txn_opinfo memory leak
|
|
|
d1681e |
|
|
|
d1681e |
For transactions where there's no volname involved (eg : gluster v
|
|
|
d1681e |
status), the originator node initiates with staging phase and what that
|
|
|
d1681e |
means in op-sm there's no unlock event triggered which resulted into a
|
|
|
d1681e |
txn_opinfo dictionary leak.
|
|
|
d1681e |
|
|
|
d1681e |
Credits : cynthia.zhou@nokia-sbell.com
|
|
|
d1681e |
|
|
|
d1681e |
> upstream patch : https://review.gluster.org/#/c/19801/
|
|
|
d1681e |
|
|
|
d1681e |
>Change-Id: I92fffbc2e8e1b010f489060f461be78aa2b86615
|
|
|
d1681e |
>Fixes: bz#1550339
|
|
|
d1681e |
>Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
d1681e |
|
|
|
d1681e |
Change-Id: I92fffbc2e8e1b010f489060f461be78aa2b86615
|
|
|
d1681e |
BUG: 1529451
|
|
|
d1681e |
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
d1681e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/134448
|
|
|
d1681e |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
d1681e |
---
|
|
|
d1681e |
xlators/mgmt/glusterd/src/glusterd-handler.c | 1 +
|
|
|
d1681e |
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 32 ++++++++++++++++++++--------
|
|
|
d1681e |
xlators/mgmt/glusterd/src/glusterd-op-sm.h | 1 +
|
|
|
d1681e |
3 files changed, 25 insertions(+), 9 deletions(-)
|
|
|
d1681e |
|
|
|
d1681e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
d1681e |
index ddab159..dbf80a1 100644
|
|
|
d1681e |
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
d1681e |
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
d1681e |
@@ -1073,6 +1073,7 @@ __glusterd_handle_stage_op (rpcsvc_request_t *req)
|
|
|
d1681e |
glusterd_txn_opinfo_init (&txn_op_info, &state, &op_req.op,
|
|
|
d1681e |
req_ctx->dict, req);
|
|
|
d1681e |
|
|
|
d1681e |
+ txn_op_info.skip_locking = _gf_true;
|
|
|
d1681e |
ret = glusterd_set_txn_opinfo (txn_id, &txn_op_info);
|
|
|
d1681e |
if (ret) {
|
|
|
d1681e |
gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
d1681e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
d1681e |
index a02a0b3..72d349b 100644
|
|
|
d1681e |
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
d1681e |
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
d1681e |
@@ -5919,14 +5919,15 @@ glusterd_op_init_commit_rsp_dict (glusterd_op_t op)
|
|
|
d1681e |
static int
|
|
|
d1681e |
glusterd_op_ac_commit_op (glusterd_op_sm_event_t *event, void *ctx)
|
|
|
d1681e |
{
|
|
|
d1681e |
- int ret = 0;
|
|
|
d1681e |
- glusterd_req_ctx_t *req_ctx = NULL;
|
|
|
d1681e |
- int32_t status = 0;
|
|
|
d1681e |
- char *op_errstr = NULL;
|
|
|
d1681e |
- dict_t *dict = NULL;
|
|
|
d1681e |
- dict_t *rsp_dict = NULL;
|
|
|
d1681e |
- xlator_t *this = NULL;
|
|
|
d1681e |
- uuid_t *txn_id = NULL;
|
|
|
d1681e |
+ int ret = 0;
|
|
|
d1681e |
+ glusterd_req_ctx_t *req_ctx = NULL;
|
|
|
d1681e |
+ int32_t status = 0;
|
|
|
d1681e |
+ char *op_errstr = NULL;
|
|
|
d1681e |
+ dict_t *dict = NULL;
|
|
|
d1681e |
+ dict_t *rsp_dict = NULL;
|
|
|
d1681e |
+ xlator_t *this = NULL;
|
|
|
d1681e |
+ uuid_t *txn_id = NULL;
|
|
|
d1681e |
+ glusterd_op_info_t txn_op_info = {{0},};
|
|
|
d1681e |
|
|
|
d1681e |
this = THIS;
|
|
|
d1681e |
GF_ASSERT (this);
|
|
|
d1681e |
@@ -5965,6 +5966,15 @@ glusterd_op_ac_commit_op (glusterd_op_sm_event_t *event, void *ctx)
|
|
|
d1681e |
ret = -1;
|
|
|
d1681e |
goto out;
|
|
|
d1681e |
}
|
|
|
d1681e |
+ ret = glusterd_get_txn_opinfo (&event->txn_id, &txn_op_info);
|
|
|
d1681e |
+ if (ret) {
|
|
|
d1681e |
+ gf_msg_callingfn (this->name, GF_LOG_ERROR, 0,
|
|
|
d1681e |
+ GD_MSG_TRANS_OPINFO_GET_FAIL,
|
|
|
d1681e |
+ "Unable to get transaction opinfo "
|
|
|
d1681e |
+ "for transaction ID : %s",
|
|
|
d1681e |
+ uuid_utoa (event->txn_id));
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
|
|
|
d1681e |
ret = dict_set_bin (rsp_dict, "transaction_id",
|
|
|
d1681e |
txn_id, sizeof(*txn_id));
|
|
|
d1681e |
@@ -5985,7 +5995,11 @@ out:
|
|
|
d1681e |
|
|
|
d1681e |
if (rsp_dict)
|
|
|
d1681e |
dict_unref (rsp_dict);
|
|
|
d1681e |
-
|
|
|
d1681e |
+ /* for no volname transactions, the txn_opinfo needs to be cleaned up
|
|
|
d1681e |
+ * as there's no unlock event triggered
|
|
|
d1681e |
+ */
|
|
|
d1681e |
+ if (txn_op_info.skip_locking)
|
|
|
d1681e |
+ ret = glusterd_clear_txn_opinfo (txn_id);
|
|
|
d1681e |
gf_msg_debug (this->name, 0, "Returning with %d", ret);
|
|
|
d1681e |
|
|
|
d1681e |
return ret;
|
|
|
d1681e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.h b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
|
|
|
d1681e |
index 24b1944..f2aee9c 100644
|
|
|
d1681e |
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.h
|
|
|
d1681e |
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
|
|
|
d1681e |
@@ -101,6 +101,7 @@ struct glusterd_op_info_ {
|
|
|
d1681e |
char *op_errstr;
|
|
|
d1681e |
struct cds_list_head pending_bricks;
|
|
|
d1681e |
uint32_t txn_generation;
|
|
|
d1681e |
+ gf_boolean_t skip_locking;
|
|
|
d1681e |
};
|
|
|
d1681e |
|
|
|
d1681e |
typedef struct glusterd_op_info_ glusterd_op_info_t;
|
|
|
d1681e |
--
|
|
|
d1681e |
1.8.3.1
|
|
|
d1681e |
|