Blob Blame History Raw
From d5c992526dcb67366bd860a56b9cde68148a5a38 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Tue, 27 Jun 2017 21:09:49 +0530
Subject: [PATCH 533/539] glusterd: mark brickinfo to started on successful
 attach

brickinfo's port & status should be filled up only when attach brick is
successful.

>Reviewed-on: https://review.gluster.org/17640
>Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>

Change-Id: I68b181be37cb94d176f0f4692e8d9dac5493181c
BUG: 1466608
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/110561
---
 tests/basic/multiplex.t                    | 6 ++++++
 xlators/mgmt/glusterd/src/glusterd-utils.c | 9 ++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/tests/basic/multiplex.t b/tests/basic/multiplex.t
index b69fe57..0a67240 100644
--- a/tests/basic/multiplex.t
+++ b/tests/basic/multiplex.t
@@ -66,3 +66,9 @@ nbrick0=$(ls $B0/brick0/file?? | wc -l)
 nbrick1=$(ls $B0/brick1/file?? | wc -l)
 TEST [ $((nbrick0 + nbrick1)) -eq 90 ]
 TEST [ $((nbrick0 * nbrick1)) -ne 0 ]
+
+pkill gluster
+TEST glusterd
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT 1 count_brick_pids
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT 1 count_brick_processes
+
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 18249ea..82034ad 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -5065,11 +5065,6 @@ attach_brick (xlator_t *this,
                         "adding brick to process failed");
                 return -1;
         }
-
-        brickinfo->port = other_brick->port;
-        brickinfo->status = GF_BRICK_STARTED;
-        brickinfo->rpc = rpc_clnt_ref (other_brick->rpc);
-
         GLUSTERD_GET_BRICK_PIDFILE (pidfile1, other_vol, other_brick, conf);
         GLUSTERD_GET_BRICK_PIDFILE (pidfile2, volinfo, brickinfo, conf);
 
@@ -5095,6 +5090,10 @@ attach_brick (xlator_t *this,
                                   successfully
                                 */
                                 glusterd_copy_file (pidfile1, pidfile2);
+                                brickinfo->port = other_brick->port;
+                                brickinfo->status = GF_BRICK_STARTED;
+                                brickinfo->rpc =
+                                        rpc_clnt_ref (other_brick->rpc);
                                 return 0;
                         }
                 }
-- 
1.8.3.1