7c2869
From 016554cf28524238526d959ccd5456e232785780 Mon Sep 17 00:00:00 2001
7c2869
From: Atin Mukherjee <amukherj@redhat.com>
7c2869
Date: Sun, 1 Apr 2018 22:10:30 +0530
7c2869
Subject: [PATCH 684/685] glusterd: show brick online after port registration
7c2869
7c2869
	Upstream patch: https://review.gluster.org/19804
7c2869
7c2869
gluster-block project needs a dependency check to see if all the bricks
7c2869
are online before bringing up the relevant gluster-block services. While
7c2869
the patch https://review.gluster.org/#/c/19785/ attempts to write the
7c2869
script but brick should be only marked as online only when the
7c2869
pmap_signin is completed.
7c2869
7c2869
While this is perfectly fine for non brick multiplexing, but with brick
7c2869
multiplexing this patch still doesn't eliminate the race completely as
7c2869
the attach_req call is asynchrnous and glusterd immediately marks the
7c2869
port as registerd.
7c2869
7c2869
 >Fixes: bz#1563273
7c2869
BUG: 1598353
7c2869
Change-Id: I81db54b88f7315e1b24e0234beebe00de6429f9d
7c2869
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
7c2869
Reviewed-on: https://code.engineering.redhat.com/gerrit/143268
7c2869
Tested-by: RHGS Build Bot <nigelb@redhat.com>
7c2869
---
7c2869
 xlators/mgmt/glusterd/src/glusterd-utils.c | 4 +++-
7c2869
 1 file changed, 3 insertions(+), 1 deletion(-)
7c2869
7c2869
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
7c2869
index f219fd5..828155d 100644
7c2869
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
7c2869
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
7c2869
@@ -5891,6 +5891,7 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
7c2869
                         (void) pmap_registry_bind (this,
7c2869
                                         brickinfo->port, brickinfo->path,
7c2869
                                         GF_PMAP_PORT_BRICKSERVER, NULL);
7c2869
+                        brickinfo->port_registered = _gf_true;
7c2869
                         /*
7c2869
                          * This will unfortunately result in a separate RPC
7c2869
                          * connection per brick, even though they're all in
7c2869
@@ -6990,7 +6991,8 @@ glusterd_add_brick_to_dict (glusterd_volinfo_t *volinfo,
7c2869
         GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, brickinfo, priv);
7c2869
 
7c2869
         if (glusterd_is_brick_started (brickinfo)) {
7c2869
-                if (gf_is_service_running (pidfile, &pid)) {
7c2869
+                if (gf_is_service_running (pidfile, &pid) &&
7c2869
+                    brickinfo->port_registered) {
7c2869
                         brick_online = _gf_true;
7c2869
                 } else {
7c2869
                         pid = -1;
7c2869
-- 
7c2869
1.8.3.1
7c2869