summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c136
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c60
2 files changed, 196 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index b5dae564926..076ae8ef56b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -3412,6 +3412,12 @@ glusterd_op_sm_locking_failed (uuid_t *txn_id)
opinfo.op_ret = -1;
opinfo.op_errstr = gf_strdup ("locking failed for one of the peer.");
+ ret = glusterd_set_txn_opinfo (txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
/* Inject a reject event such that unlocking gets triggered right away*/
ret = glusterd_op_sm_inject_event (GD_OP_EVENT_RCVD_RJT, txn_id, NULL);
@@ -3508,6 +3514,15 @@ glusterd_op_ac_send_lock (glusterd_op_sm_event_t *event, void *ctx)
rcu_read_unlock ();
opinfo.pending_count = pending_count;
+
+ ret = glusterd_set_txn_opinfo (&event->txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
+
if (!opinfo.pending_count)
ret = glusterd_op_sm_inject_all_acc (&event->txn_id);
@@ -3615,6 +3630,14 @@ glusterd_op_ac_send_unlock (glusterd_op_sm_event_t *event, void *ctx)
rcu_read_unlock ();
opinfo.pending_count = pending_count;
+
+ ret = glusterd_set_txn_opinfo (&event->txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
if (!opinfo.pending_count)
ret = glusterd_op_sm_inject_all_acc (&event->txn_id);
@@ -3630,6 +3653,15 @@ glusterd_op_ac_ack_drain (glusterd_op_sm_event_t *event, void *ctx)
if (opinfo.pending_count > 0)
opinfo.pending_count--;
+
+ ret = glusterd_set_txn_opinfo (&event->txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
+
if (!opinfo.pending_count)
ret = glusterd_op_sm_inject_event (GD_OP_EVENT_ALL_ACK,
&event->txn_id, NULL);
@@ -3804,6 +3836,14 @@ glusterd_op_ac_rcvd_lock_acc (glusterd_op_sm_event_t *event, void *ctx)
if (opinfo.pending_count > 0)
opinfo.pending_count--;
+ ret = glusterd_set_txn_opinfo (&event->txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
+
if (opinfo.pending_count > 0)
goto out;
@@ -4119,6 +4159,7 @@ static int
glusterd_op_ac_send_stage_op (glusterd_op_sm_event_t *event, void *ctx)
{
int ret = 0;
+ int ret1 = 0;
rpc_clnt_procedure_t *proc = NULL;
glusterd_conf_t *priv = NULL;
xlator_t *this = NULL;
@@ -4221,6 +4262,17 @@ glusterd_op_ac_send_stage_op (glusterd_op_sm_event_t *event, void *ctx)
opinfo.pending_count = pending_count;
out:
+ if (ret)
+ opinfo.op_ret = ret;
+
+ ret1 = glusterd_set_txn_opinfo (&event->txn_id, &opinfo);
+ if (ret1)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
+
if (rsp_dict)
dict_unref (rsp_dict);
@@ -4768,6 +4820,7 @@ static int
glusterd_op_ac_send_commit_op (glusterd_op_sm_event_t *event, void *ctx)
{
int ret = 0;
+ int ret1 = 0;
rpc_clnt_procedure_t *proc = NULL;
glusterd_conf_t *priv = NULL;
xlator_t *this = NULL;
@@ -4855,6 +4908,17 @@ glusterd_op_ac_send_commit_op (glusterd_op_sm_event_t *event, void *ctx)
out:
if (dict)
dict_unref (dict);
+
+ if (ret)
+ opinfo.op_ret = ret;
+
+ ret1 = glusterd_set_txn_opinfo (&event->txn_id, &opinfo);
+ if (ret1)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
if (ret) {
glusterd_op_sm_inject_event (GD_OP_EVENT_RCVD_RJT,
&event->txn_id, NULL);
@@ -4888,6 +4952,16 @@ glusterd_op_ac_rcvd_stage_op_acc (glusterd_op_sm_event_t *event, void *ctx)
if (opinfo.pending_count > 0)
opinfo.pending_count--;
+
+ ret = glusterd_set_txn_opinfo (&event->txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
+
+
if (opinfo.pending_count > 0)
goto out;
@@ -4910,6 +4984,16 @@ glusterd_op_ac_stage_op_failed (glusterd_op_sm_event_t *event, void *ctx)
if (opinfo.pending_count > 0)
opinfo.pending_count--;
+
+ ret = glusterd_set_txn_opinfo (&event->txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
+
+
if (opinfo.pending_count > 0)
goto out;
@@ -4932,6 +5016,16 @@ glusterd_op_ac_commit_op_failed (glusterd_op_sm_event_t *event, void *ctx)
if (opinfo.pending_count > 0)
opinfo.pending_count--;
+
+ ret = glusterd_set_txn_opinfo (&event->txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
+
+
if (opinfo.pending_count > 0)
goto out;
@@ -4977,6 +5071,15 @@ glusterd_op_ac_brick_op_failed (glusterd_op_sm_event_t *event, void *ctx)
else
free_errstr = _gf_true;
+
+ ret = glusterd_set_txn_opinfo (&event->txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
+
if (opinfo.brick_pending_count > 0)
goto out;
@@ -5010,6 +5113,14 @@ glusterd_op_ac_rcvd_commit_op_acc (glusterd_op_sm_event_t *event, void *ctx)
if (opinfo.pending_count > 0)
opinfo.pending_count--;
+ ret = glusterd_set_txn_opinfo (&event->txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
+
if (opinfo.pending_count > 0)
goto out;
@@ -5055,6 +5166,14 @@ glusterd_op_ac_rcvd_unlock_acc (glusterd_op_sm_event_t *event, void *ctx)
if (opinfo.pending_count > 0)
opinfo.pending_count--;
+ ret = glusterd_set_txn_opinfo (&event->txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
+
if (opinfo.pending_count > 0)
goto out;
@@ -5409,6 +5528,14 @@ glusterd_op_ac_send_commit_failed (glusterd_op_sm_event_t *event, void *ctx)
opinfo.op_errstr = NULL;
}
+ ret = glusterd_set_txn_opinfo (&event->txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
+
gf_msg_debug (THIS->name, 0, "Returning with %d", ret);
return ret;
}
@@ -7044,6 +7171,15 @@ glusterd_op_ac_rcvd_brick_op_acc (glusterd_op_sm_event_t *event, void *ctx)
if (opinfo.brick_pending_count > 0)
opinfo.brick_pending_count--;
+
+ ret = glusterd_set_txn_opinfo (&event->txn_id, &opinfo);
+ if (ret)
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
+
glusterd_handle_node_rsp (req_ctx->dict, pending_entry, op, ev_ctx->rsp_dict,
op_ctx, &op_errstr, type);
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index fd51255f65b..e670c98a7c9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -784,6 +784,15 @@ __glusterd_cluster_lock_cbk (struct rpc_req *req, struct iovec *iov,
}
out:
+
+ ret = glusterd_set_txn_opinfo (txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
+
ret = glusterd_op_sm_inject_event (event_type, txn_id, NULL);
if (!ret) {
@@ -894,6 +903,14 @@ glusterd_mgmt_v3_lock_peers_cbk_fn (struct rpc_req *req, struct iovec *iov,
}
out:
+
+ ret = glusterd_set_txn_opinfo (txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
ret = glusterd_op_sm_inject_event (event_type, txn_id, NULL);
if (!ret) {
glusterd_friend_sm ();
@@ -997,6 +1014,14 @@ glusterd_mgmt_v3_unlock_peers_cbk_fn (struct rpc_req *req, struct iovec *iov,
}
out:
+
+ ret = glusterd_set_txn_opinfo (txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
ret = glusterd_op_sm_inject_event (event_type, txn_id, NULL);
if (!ret) {
@@ -1095,6 +1120,14 @@ __glusterd_cluster_unlock_cbk (struct rpc_req *req, struct iovec *iov,
}
out:
+
+ ret = glusterd_set_txn_opinfo (txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
ret = glusterd_op_sm_inject_event (event_type, txn_id, NULL);
if (!ret) {
@@ -1229,6 +1262,13 @@ out:
rcu_read_unlock ();
+ ret = glusterd_set_txn_opinfo (txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
ret = glusterd_op_sm_inject_event (event_type, txn_id, NULL);
if (!ret) {
@@ -1404,6 +1444,14 @@ unlock:
rcu_read_unlock ();
out:
+
+ ret = glusterd_set_txn_opinfo (txn_id, &opinfo);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
ret = glusterd_op_sm_inject_event (event_type, txn_id, NULL);
if (!ret) {
@@ -2188,6 +2236,7 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this,
gd1_mgmt_brick_op_req *req = NULL;
int ret = 0;
+ int ret1 = 0;
glusterd_conf_t *priv = NULL;
call_frame_t *dummy_frame = NULL;
char *op_errstr = NULL;
@@ -2311,6 +2360,17 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this,
opinfo.brick_pending_count = pending_bricks;
out:
+
+ if (ret)
+ opinfo.op_ret = ret;
+
+ ret1 = glusterd_set_txn_opinfo (txn_id, &opinfo);
+ if (ret1)
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
+ "Unable to set "
+ "transaction's opinfo");
+
if (ret) {
glusterd_op_sm_inject_event (GD_OP_EVENT_RCVD_RJT,
txn_id, data);