summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2014-05-29 11:59:30 +0000
committerKrishnan Parthasarathi <kparthas@redhat.com>2014-06-02 04:42:39 -0700
commite8c13fa9bd2a838335e923ec48bcb66e2cb5861d (patch)
tree8c220e6ae06b790f0092ae0e9a06ccc560b477a8 /xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
parent4f9314a5eda016d5a03ad637f2c6171794cc9291 (diff)
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 <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/7926 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-rpc-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index 216806f4457..7025e9844db 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -897,11 +897,16 @@ __glusterd_stage_op_cbk (struct rpc_req *req, struct iovec *iov,
char err_str[2048] = {0};
char *peer_str = NULL;
xlator_t *this = NULL;
+ glusterd_conf_t *priv = NULL;
uuid_t *txn_id = NULL;
this = THIS;
GF_ASSERT (this);
GF_ASSERT (req);
+ priv = this->private;
+ GF_ASSERT (priv);
+
+ txn_id = &priv->global_txn_id;
if (-1 == req->rpc_status) {
rsp.op_ret = -1;
@@ -951,17 +956,14 @@ out:
(op_ret) ? "RJT" : "ACC", uuid_utoa (rsp.uuid));
ret = dict_get_bin (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_friend_find (rsp.uuid, NULL, &peerinfo);
-
- if (ret) {
+ if (ret)
gf_log (this->name, GF_LOG_CRITICAL, "Stage response received "
"from unknown peer: %s. Ignoring response.",
uuid_utoa (rsp.uuid));
- goto out;
- }
if (op_ret) {
event_type = GD_OP_EVENT_RCVD_RJT;
@@ -977,10 +979,8 @@ out:
OPERRSTR_STAGE_FAIL, peer_str);
opinfo.op_errstr = gf_strdup (err_str);
}
- if (!opinfo.op_errstr) {
+ if (!opinfo.op_errstr)
ret = -1;
- goto out;
- }
} else {
event_type = GD_OP_EVENT_RCVD_ACC;
}
@@ -1031,12 +1031,16 @@ __glusterd_commit_op_cbk (struct rpc_req *req, struct iovec *iov,
char err_str[2048] = {0};
char *peer_str = NULL;
xlator_t *this = NULL;
+ glusterd_conf_t *priv = NULL;
uuid_t *txn_id = NULL;
-
this = THIS;
GF_ASSERT (this);
GF_ASSERT (req);
+ priv = this->private;
+ GF_ASSERT (priv);
+
+ txn_id = &priv->global_txn_id;
if (-1 == req->rpc_status) {
rsp.op_ret = -1;
@@ -1087,11 +1091,10 @@ __glusterd_commit_op_cbk (struct rpc_req *req, struct iovec *iov,
(op_ret)?"RJT":"ACC", uuid_utoa (rsp.uuid));
ret = dict_get_bin (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_friend_find (rsp.uuid, NULL, &peerinfo);
-
if (ret) {
gf_log (this->name, GF_LOG_CRITICAL, "Commit response for "
"'Volume %s' received from unknown peer: %s",
@@ -1791,9 +1794,12 @@ __glusterd_brick_op_cbk (struct rpc_req *req, struct iovec *iov,
}
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));
+ if (req_ctx && req_ctx->dict) {
+ 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));
+ }
ev_ctx = GF_CALLOC (1, sizeof (*ev_ctx), gf_gld_mt_brick_rsp_ctx_t);
GF_ASSERT (ev_ctx);
@@ -1857,6 +1863,11 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this,
req_ctx = data;
GF_ASSERT (req_ctx);
INIT_LIST_HEAD (&opinfo.pending_bricks);
+
+ 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));
+
ret = glusterd_op_bricks_select (req_ctx->op, req_ctx->dict, &op_errstr,
&opinfo.pending_bricks, NULL);
@@ -1868,11 +1879,6 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this,
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));
-
list_for_each_entry (pending_node, &opinfo.pending_bricks, list) {
dummy_frame = create_frame (this, this->ctx->pool);
if (!dummy_frame)