From 6333e300cba4a2611815dd6fd53e0e246c2b0167 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Thu, 9 Jul 2015 12:17:59 +0530
Subject: [PATCH 216/234] glusterd: correct replace-brick flow
commit 9d2971 assumed that replace-brick is a op-sm transaction. This patch
fixes the replace brick flow as its a syncop transaction now.
Change-Id: I4c18a9c8db6173632b6d94d8609a7af3b912ae48
BUG: 1230525
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/52639
Reviewed-by: Anand Nekkunti <anekkunt@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 14 --------------
xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | 21 ---------------------
xlators/mgmt/glusterd/src/glusterd-syncop.c | 5 +++++
3 files changed, 5 insertions(+), 35 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index b1ee5e3..dbdaec0 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -3996,7 +3996,6 @@ glusterd_op_ac_send_stage_op (glusterd_op_sm_event_t *event, void *ctx)
char *op_errstr = NULL;
glusterd_op_t op = GD_OP_NONE;
uint32_t pending_count = 0;
- glusterd_op_info_t txn_op_info = {{0},};
this = THIS;
GF_ASSERT (this);
@@ -4048,19 +4047,6 @@ glusterd_op_ac_send_stage_op (glusterd_op_sm_event_t *event, void *ctx)
goto out;
}
- if (op == GD_OP_REPLACE_BRICK) {
- ret = glusterd_get_txn_opinfo (&event->txn_id, &txn_op_info);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- GD_MSG_TRANS_OPINFO_GET_FAIL,
- "Failed to get txn_op_info "
- "for txn_id = %s", uuid_utoa (event->txn_id));
- goto out;
- }
-
- glusterd_rb_use_rsp_dict (txn_op_info.op_ctx, rsp_dict);
- }
-
rcu_read_lock ();
cds_list_for_each_entry_rcu (peerinfo, &priv->peers, uuid_list) {
/* Only send requests to peers who were available before the
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index 50820d7..0890b02 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -1131,7 +1131,6 @@ __glusterd_stage_op_cbk (struct rpc_req *req, struct iovec *iov,
xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
uuid_t *txn_id = NULL;
- glusterd_op_info_t txn_op_info = {{0},};
this = THIS;
GF_ASSERT (this);
@@ -1201,14 +1200,6 @@ out:
gf_msg_debug (this->name, 0, "transaction ID = %s",
uuid_utoa (*txn_id));
- ret = glusterd_get_txn_opinfo (txn_id, &txn_op_info);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- GD_MSG_TRANS_OPINFO_GET_FAIL,
- "Failed to get txn_op_info "
- "for txn_id = %s", uuid_utoa (*txn_id));
- }
-
rcu_read_lock ();
peerinfo = glusterd_peerinfo_find (rsp.uuid, NULL);
if (peerinfo == NULL) {
@@ -1240,12 +1231,6 @@ out:
rcu_read_unlock ();
- switch (rsp.op) {
- case GD_OP_REPLACE_BRICK:
- glusterd_rb_use_rsp_dict (txn_op_info.op_ctx, dict);
- break;
- }
-
ret = glusterd_op_sm_inject_event (event_type, txn_id, NULL);
if (!ret) {
@@ -1398,12 +1383,6 @@ __glusterd_commit_op_cbk (struct rpc_req *req, struct iovec *iov,
GF_ASSERT (rsp.op == txn_op_info.op);
switch (rsp.op) {
- case GD_OP_REPLACE_BRICK:
- ret = glusterd_rb_use_rsp_dict (txn_op_info.op_ctx, dict);
- if (ret)
- goto unlock;
- break;
-
case GD_OP_PROFILE_VOLUME:
ret = glusterd_profile_volume_use_rsp_dict (txn_op_info.op_ctx, dict);
if (ret)
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index 1d5deb8..5a1ffb4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -245,6 +245,11 @@ glusterd_syncop_aggr_rsp_dict (glusterd_op_t op, dict_t *aggr, dict_t *rsp)
}
break;
+ case GD_OP_REPLACE_BRICK:
+ ret = glusterd_rb_use_rsp_dict (aggr, rsp);
+ if (ret)
+ goto out;
+ break;
case GD_OP_SYNC_VOLUME:
ret = glusterd_sync_use_rsp_dict (aggr, rsp);
--
1.7.1