diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2018-04-01 22:10:30 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2018-04-05 16:11:00 +0000 |
commit | ed51b60c6b33024885d9876b23cb6554055e49a1 (patch) | |
tree | 3748e573e58893385892f0008f24bee0855b647b | |
parent | d9ceaf3203ffafb4bfe4693b47df1259abbd167a (diff) |
glusterd: show brick online after port registration
gluster-block project needs a dependency check to see if all the bricks
are online before bringing up the relevant gluster-block services. While
the patch https://review.gluster.org/#/c/19785/ attempts to write the
script but brick should be only marked as online only when the
pmap_signin is completed.
While this is perfectly fine for non brick multiplexing, but with brick
multiplexing this patch still doesn't eliminate the race completely as
the attach_req call is asynchrnous and glusterd immediately marks the
port as registerd.
Change-Id: I81db54b88f7315e1b24e0234beebe00de6429f9d
Fixes: bz#1563273
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 24d813fbdbb..6437d038cd3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -5986,6 +5986,7 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo, (void) pmap_registry_bind (this, brickinfo->port, brickinfo->path, GF_PMAP_PORT_BRICKSERVER, NULL); + brickinfo->port_registered = _gf_true; /* * This will unfortunately result in a separate RPC * connection per brick, even though they're all in @@ -5995,7 +5996,6 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo, * TBD: re-use RPC connection across bricks */ if (is_brick_mx_enabled ()) { - brickinfo->port_registered = _gf_true; ret = glusterd_get_sock_from_brick_pid (pid, socketpath, sizeof(socketpath)); if (ret) { @@ -7102,7 +7102,8 @@ glusterd_add_brick_to_dict (glusterd_volinfo_t *volinfo, GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, brickinfo, priv); if (glusterd_is_brick_started (brickinfo)) { - if (gf_is_service_running (pidfile, &pid)) { + if (gf_is_service_running (pidfile, &pid) && + brickinfo->port_registered) { brick_online = _gf_true; } else { pid = -1; |