Blob Blame History Raw
From 98f90d99e2234a0a700ce596e66c9733977150b9 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Mon, 17 Oct 2016 16:08:41 +0530
Subject: [PATCH 110/141] glusterd: set the brickinfo->port before spawning the bricks

As of now, when glusterd spawns a brick process, post spawning, the brickinfo's
port is set. The side effect of this is it opens up an window where the
pmap_signin event can be initiated by the brick to glusterd and glusterd fails
to update signed_in flag since the brickinfo port is still 0 and the comparison
of port and brickinfo->port fails.

As a solution, set the brickinfo->port post pmap_registry_alloc and if the brick
spawn fails reset it to 0. This logic applies for rdma port too.

>Reviewed-on: http://review.gluster.org/15655
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
>Reviewed-by: Jeff Darcy <jdarcy@redhat.com>

>Reviewed-on: http://review.gluster.org/15679
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>

Change-Id: I00a13d4c6d6809ebd19a972aa13e71ee5eac7e35
BUG: 1386538
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/87882
---
 xlators/mgmt/glusterd/src/glusterd-utils.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index bf27fe3..dd8766b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1916,6 +1916,10 @@ retry:
                 runner_add_arg (&runner, "--mem-accounting");
 
         runner_log (&runner, "", 0, "Starting GlusterFS");
+
+        brickinfo->port = port;
+        brickinfo->rdma_port = rdma_port;
+
         if (wait) {
                 synclock_unlock (&priv->big_lock);
                 ret = runner_run (&runner);
@@ -1945,11 +1949,11 @@ retry:
                 ret = runner_run_nowait (&runner);
         }
 
-        if (ret)
+        if (ret) {
+                brickinfo->port = 0;
+                brickinfo->rdma_port = 0;
                 goto out;
-
-        brickinfo->port = port;
-        brickinfo->rdma_port = rdma_port;
+        }
 
 connect:
         ret = glusterd_brick_connect (volinfo, brickinfo, socketpath);
-- 
1.7.1