summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-handler.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index a95989c..d109e11 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -695,14 +695,14 @@ local_locking_done:
}
/* Save opinfo for this transaction with the transaction id */
- txn_op_info.op = op;
- txn_op_info.op_ctx = ctx;
- txn_op_info.req = req;
+ glusterd_txn_opinfo_init (&txn_op_info, NULL, &op, ctx, req);
ret = glusterd_set_txn_opinfo (txn_id, &txn_op_info);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Unable to set transaction's opinfo");
+ if (ctx)
+ dict_unref (ctx);
goto out;
}
@@ -739,13 +739,15 @@ out:
int
__glusterd_handle_cluster_lock (rpcsvc_request_t *req)
{
- gd1_mgmt_cluster_lock_req lock_req = {{0},};
- int32_t ret = -1;
- glusterd_op_lock_ctx_t *ctx = NULL;
- glusterd_peerinfo_t *peerinfo = NULL;
- xlator_t *this = NULL;
- uuid_t *txn_id = &global_txn_id;
+ dict_t *op_ctx = NULL;
+ int32_t ret = -1;
+ gd1_mgmt_cluster_lock_req lock_req = {{0},};
+ glusterd_op_lock_ctx_t *ctx = NULL;
+ glusterd_op_t op = GD_OP_EVENT_LOCK;
+ glusterd_peerinfo_t *peerinfo = NULL;
glusterd_op_info_t txn_op_info = {{0},};
+ uuid_t *txn_id = &global_txn_id;
+ xlator_t *this = NULL;
this = THIS;
GF_ASSERT (this);
@@ -782,20 +784,20 @@ __glusterd_handle_cluster_lock (rpcsvc_request_t *req)
ctx->req = req;
ctx->dict = NULL;
- txn_op_info.op = GD_OP_EVENT_LOCK;
- txn_op_info.op_ctx = dict_new ();
- if (!txn_op_info.op_ctx) {
+ op_ctx = dict_new ();
+ if (!op_ctx) {
gf_log (this->name, GF_LOG_ERROR,
"Unable to set new dict");
goto out;
}
- txn_op_info.req = req;
+
+ glusterd_txn_opinfo_init (&txn_op_info, NULL, &op, op_ctx, req);
ret = glusterd_set_txn_opinfo (txn_id, &txn_op_info);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Unable to set transaction's opinfo");
- dict_destroy (txn_op_info.op_ctx);
+ dict_unref (txn_op_info.op_ctx);
goto out;
}
@@ -880,6 +882,7 @@ __glusterd_handle_stage_op (rpcsvc_request_t *req)
xlator_t *this = NULL;
uuid_t *txn_id = &global_txn_id;
glusterd_op_info_t txn_op_info = {{0},};
+ glusterd_op_sm_state_info_t state;
this = THIS;
GF_ASSERT (this);
@@ -917,19 +920,18 @@ __glusterd_handle_stage_op (rpcsvc_request_t *req)
* phase where the transaction opinfos are created, won't be called. */
ret = glusterd_get_txn_opinfo (txn_id, &txn_op_info);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "Unable to get transaction's opinfo");
+ gf_log (this->name, GF_LOG_DEBUG,
+ "No transaction's opinfo set");
- txn_op_info.op = op_req.op;
- txn_op_info.state.state = GD_OP_STATE_LOCKED;
- txn_op_info.op_ctx = req_ctx->dict;
- txn_op_info.req = req;
+ state.state = GD_OP_STATE_LOCKED;
+ glusterd_txn_opinfo_init (&txn_op_info, &state,
+ &op_req.op, req_ctx->dict, req);
ret = glusterd_set_txn_opinfo (txn_id, &txn_op_info);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Unable to set transaction's opinfo");
- dict_destroy (req_ctx->dict);
+ dict_unref (req_ctx->dict);
goto out;
}
}