3604df
From 3779c6ce05b04d8a4ec2a4971f0987e471afb33f Mon Sep 17 00:00:00 2001
3604df
From: Atin Mukherjee <amukherj@redhat.com>
3604df
Date: Fri, 21 Oct 2016 18:27:45 +0530
3604df
Subject: [PATCH 153/157] glusterd: use GF_BRICK_STOPPING as intermediate brickinfo->status state
3604df
3604df
On a volume stop trigger glusterd issues a brick-op to terminate the brick
3604df
process during brick-op phase , however in the commit-op glusterd once again
3604df
tries to kill the same process if it exists and then mark the brickinfo->status
3604df
flag to GF_BRICK_STOPPED. In the former case, if brick is successfully killed
3604df
there is a possibility that GlusterD will receive RPC_CLNT_DISCONNECT from the
3604df
said brick process before even the commit op phase is executed and hence by that
3604df
time brickinfo->status will still be set to GF_BRICK_STARTED.
3604df
3604df
BRICK_DISCONNECT event should be only sent if a brick has been killed and not
3604df
through a volume stop/remove brick trigger, however due to this trace, this
3604df
event is also sent out on a volume stop.
3604df
3604df
Fix is to introduce an intermediate state GF_BRICK_STOPPING which can be used to
3604df
mark the brick status at brick op phase of volume stop/remove brick to avoid
3604df
sending spurious BRICK_DISCONNECT events on a volume stop trigger.
3604df
3604df
This patch fixes BZ 1385561 as well
3604df
3604df
>Reviewed-on: http://review.gluster.org/15699
3604df
>Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
>Reviewed-by: Kaushal M <kaushal@redhat.com>
3604df
3604df
Change-Id: Ieed4450e1c988715e0f9958be44faa6b14be81e1
3604df
BUG: 1387544
3604df
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/89352
3604df
---
3604df
 xlators/mgmt/glusterd/src/glusterd-op-sm.c |    3 ++-
3604df
 xlators/mgmt/glusterd/src/glusterd.h       |    1 +
3604df
 2 files changed, 3 insertions(+), 1 deletions(-)
3604df
3604df
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
3604df
index 0528fbd..fcad97c 100644
3604df
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
3604df
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
3604df
@@ -577,7 +577,8 @@ glusterd_brick_op_build_payload (glusterd_op_t op, glusterd_brickinfo_t *brickin
3604df
                         goto out;
3604df
                 brick_req->op = GLUSTERD_BRICK_TERMINATE;
3604df
                 brick_req->name = "";
3604df
-        break;
3604df
+                glusterd_set_brick_status (brickinfo, GF_BRICK_STOPPING);
3604df
+                break;
3604df
         case GD_OP_PROFILE_VOLUME:
3604df
                 brick_req = GF_CALLOC (1, sizeof (*brick_req),
3604df
                                        gf_gld_mt_mop_brick_req_t);
3604df
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
3604df
index 8695ab9..23b7623 100644
3604df
--- a/xlators/mgmt/glusterd/src/glusterd.h
3604df
+++ b/xlators/mgmt/glusterd/src/glusterd.h
3604df
@@ -189,6 +189,7 @@ typedef struct {
3604df
 typedef enum gf_brick_status {
3604df
         GF_BRICK_STOPPED,
3604df
         GF_BRICK_STARTED,
3604df
+        GF_BRICK_STOPPING,
3604df
 } gf_brick_status_t;
3604df
 
3604df
 struct glusterd_brickinfo {
3604df
-- 
3604df
1.7.1
3604df