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