21ab4e
From d5c992526dcb67366bd860a56b9cde68148a5a38 Mon Sep 17 00:00:00 2001
21ab4e
From: Atin Mukherjee <amukherj@redhat.com>
21ab4e
Date: Tue, 27 Jun 2017 21:09:49 +0530
21ab4e
Subject: [PATCH 533/539] glusterd: mark brickinfo to started on successful
21ab4e
 attach
21ab4e
21ab4e
brickinfo's port & status should be filled up only when attach brick is
21ab4e
successful.
21ab4e
21ab4e
>Reviewed-on: https://review.gluster.org/17640
21ab4e
>Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
21ab4e
>Smoke: Gluster Build System <jenkins@build.gluster.org>
21ab4e
>Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
21ab4e
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
21ab4e
21ab4e
Change-Id: I68b181be37cb94d176f0f4692e8d9dac5493181c
21ab4e
BUG: 1466608
21ab4e
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/110561
21ab4e
---
21ab4e
 tests/basic/multiplex.t                    | 6 ++++++
21ab4e
 xlators/mgmt/glusterd/src/glusterd-utils.c | 9 ++++-----
21ab4e
 2 files changed, 10 insertions(+), 5 deletions(-)
21ab4e
21ab4e
diff --git a/tests/basic/multiplex.t b/tests/basic/multiplex.t
21ab4e
index b69fe57..0a67240 100644
21ab4e
--- a/tests/basic/multiplex.t
21ab4e
+++ b/tests/basic/multiplex.t
21ab4e
@@ -66,3 +66,9 @@ nbrick0=$(ls $B0/brick0/file?? | wc -l)
21ab4e
 nbrick1=$(ls $B0/brick1/file?? | wc -l)
21ab4e
 TEST [ $((nbrick0 + nbrick1)) -eq 90 ]
21ab4e
 TEST [ $((nbrick0 * nbrick1)) -ne 0 ]
21ab4e
+
21ab4e
+pkill gluster
21ab4e
+TEST glusterd
21ab4e
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT 1 count_brick_pids
21ab4e
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT 1 count_brick_processes
21ab4e
+
21ab4e
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
21ab4e
index 18249ea..82034ad 100644
21ab4e
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
21ab4e
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
21ab4e
@@ -5065,11 +5065,6 @@ attach_brick (xlator_t *this,
21ab4e
                         "adding brick to process failed");
21ab4e
                 return -1;
21ab4e
         }
21ab4e
-
21ab4e
-        brickinfo->port = other_brick->port;
21ab4e
-        brickinfo->status = GF_BRICK_STARTED;
21ab4e
-        brickinfo->rpc = rpc_clnt_ref (other_brick->rpc);
21ab4e
-
21ab4e
         GLUSTERD_GET_BRICK_PIDFILE (pidfile1, other_vol, other_brick, conf);
21ab4e
         GLUSTERD_GET_BRICK_PIDFILE (pidfile2, volinfo, brickinfo, conf);
21ab4e
 
21ab4e
@@ -5095,6 +5090,10 @@ attach_brick (xlator_t *this,
21ab4e
                                   successfully
21ab4e
                                 */
21ab4e
                                 glusterd_copy_file (pidfile1, pidfile2);
21ab4e
+                                brickinfo->port = other_brick->port;
21ab4e
+                                brickinfo->status = GF_BRICK_STARTED;
21ab4e
+                                brickinfo->rpc =
21ab4e
+                                        rpc_clnt_ref (other_brick->rpc);
21ab4e
                                 return 0;
21ab4e
                         }
21ab4e
                 }
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e