From e8c13fa9bd2a838335e923ec48bcb66e2cb5861d Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Thu, 29 May 2014 11:59:30 +0000 Subject: glusterd: Fetching the txn_id before performing glusterd_op_bricks_select in glusterd_brick_op() In glusterd_brick_op(), the txn_id mut be fetched before failing the transaction for any other reason. Moving the fetching of txn_id to the beginning of the function. Also initializing txn_id to priv->global_txn_id where it wasn't initialized. Change-Id: I44d7daa444f00a626f24670c92324725f6c5fb35 BUG: 1102656 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/7926 Tested-by: Gluster Build System Reviewed-by: Atin Mukherjee Reviewed-by: Krishnan Parthasarathi Tested-by: Krishnan Parthasarathi --- xlators/mgmt/glusterd/src/glusterd-handler.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 7303622aed7..e203e5af01f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -905,23 +905,25 @@ __glusterd_handle_stage_op (rpcsvc_request_t *req) goto out; } - if (glusterd_friend_find_by_uuid (op_req.uuid, &peerinfo)) { - gf_log (this->name, GF_LOG_WARNING, "%s doesn't " - "belong to the cluster. Ignoring request.", - uuid_utoa (op_req.uuid)); - ret = -1; - goto out; - } - ret = glusterd_req_ctx_create (req, op_req.op, op_req.uuid, op_req.buf.buf_val, op_req.buf.buf_len, gf_gld_mt_op_stage_ctx_t, &req_ctx); - if (ret) + if (ret) { + gf_log (this->name, GF_LOG_ERROR, "Failed to create req_ctx"); goto out; + } ret = dict_get_bin (req_ctx->dict, "transaction_id", (void **)&txn_id); + gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s", + uuid_utoa (*txn_id)); - gf_log ("", GF_LOG_DEBUG, "transaction ID = %s", uuid_utoa (*txn_id)); + if (glusterd_friend_find_by_uuid (op_req.uuid, &peerinfo)) { + gf_log (this->name, GF_LOG_WARNING, "%s doesn't " + "belong to the cluster. Ignoring request.", + uuid_utoa (op_req.uuid)); + ret = -1; + goto out; + } /* In cases where there is no volname, the receivers won't have a * transaction opinfo created, as for those operations, the locking @@ -1009,8 +1011,8 @@ __glusterd_handle_commit_op (rpcsvc_request_t *req) goto out; ret = dict_get_bin (req_ctx->dict, "transaction_id", (void **)&txn_id); - - gf_log ("", GF_LOG_DEBUG, "transaction ID = %s", uuid_utoa (*txn_id)); + gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s", + uuid_utoa (*txn_id)); ret = glusterd_op_sm_inject_event (GD_OP_EVENT_COMMIT_OP, txn_id, req_ctx); -- cgit