21ab4e
From 6e81337cb410a9b169a878a61d53e972763f7a2c Mon Sep 17 00:00:00 2001
21ab4e
From: Samikshan Bairagya <samikshan@gmail.com>
21ab4e
Date: Tue, 6 Jun 2017 17:08:37 +0530
21ab4e
Subject: [PATCH 488/509] glusterd: Fix regression wrt add-brick on replica
21ab4e
 count change
21ab4e
21ab4e
tests/bugs/glusterd/bug-1406411-fail-add-brick-on-replica-count-change.t
21ab4e
was failing on centos machines with brick multiplexing enabled.
21ab4e
This is because detaching individual bricks manually from the
21ab4e
backend like it is done in the regression test framework by
21ab4e
'kill_brick', fails to send a RPC_CLNT_DISCONNECT to glusterd when
21ab4e
multiplexing is enabled. This causes the add-brick command to not
21ab4e
fail when one of the bricks are killed using kill_brick in the
21ab4e
regression test framework. To fix this, set the brick status to
21ab4e
GF_BRICK_STOPPED on the glusterd end during portmap signout. This
21ab4e
commit also sets the brick status in glusterd_brick_stop() function
21ab4e
so that the brick status is correctly set to 'stopped' even when the
21ab4e
function is called independently for individual bricks.
21ab4e
21ab4e
> Reviewed-on: https://review.gluster.org/17422
21ab4e
> Smoke: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
21ab4e
> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
21ab4e
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
21ab4e
21ab4e
Change-Id: I4d6f7b579069d0cfa53cb2b0cff78876e1f31594
21ab4e
BUG: 1458569
21ab4e
Signed-off-by: Samikshan Bairagya <sbairagy@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/108299
21ab4e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
---
21ab4e
 xlators/mgmt/glusterd/src/glusterd-pmap.c  | 6 ++++++
21ab4e
 xlators/mgmt/glusterd/src/glusterd-utils.c | 8 +++++---
21ab4e
 2 files changed, 11 insertions(+), 3 deletions(-)
21ab4e
21ab4e
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c
21ab4e
index 1670b38..13b347e 100644
21ab4e
--- a/xlators/mgmt/glusterd/src/glusterd-pmap.c
21ab4e
+++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c
21ab4e
@@ -594,6 +594,12 @@ __gluster_pmap_signout (rpcsvc_request_t *req)
21ab4e
                                                     conf);
21ab4e
                         sys_unlink (pidfile);
21ab4e
                         brickinfo->started_here = _gf_false;
21ab4e
+
21ab4e
+                        /* Setting the brick status to GF_BRICK_STOPPED to
21ab4e
+                         * ensure correct brick status is maintained on the
21ab4e
+                         * glusterd end when a brick is killed from the
21ab4e
+                         * backend */
21ab4e
+                        brickinfo->status = GF_BRICK_STOPPED;
21ab4e
                 }
21ab4e
         }
21ab4e
 
21ab4e
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
21ab4e
index 6e0a906..903ee80 100644
21ab4e
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
21ab4e
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
21ab4e
@@ -2127,14 +2127,16 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,
21ab4e
                 ret = 0;
21ab4e
         }
21ab4e
 
21ab4e
-        if (del_brick)
21ab4e
-                glusterd_delete_brick (volinfo, brickinfo);
21ab4e
-
21ab4e
         GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, brickinfo, conf);
21ab4e
         gf_msg_debug (this->name,  0, "Unlinking pidfile %s", pidfile);
21ab4e
         (void) sys_unlink (pidfile);
21ab4e
 
21ab4e
         brickinfo->started_here = _gf_false;
21ab4e
+        brickinfo->status = GF_BRICK_STOPPED;
21ab4e
+
21ab4e
+        if (del_brick)
21ab4e
+                glusterd_delete_brick (volinfo, brickinfo);
21ab4e
+
21ab4e
 out:
21ab4e
         return ret;
21ab4e
 }
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e