From 81301d3b006e5490699d5bf70833d92b05a47dca Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Wed, 17 Dec 2014 11:20:20 +0000 Subject: glusterd: Copy brick port no. if brick is running Instead of relying on brickinfo->status, check if the brick process is running before copying the brick port number. Change-Id: I246465fa4cf4911da63a1c26bbb51cc4ed4630ac BUG: 1175700 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/9297 Reviewed-by: Krishnan Parthasarathi Tested-by: Krishnan Parthasarathi --- xlators/mgmt/glusterd/src/glusterd-utils.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 406d9136c61..be96884d098 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -4574,21 +4574,34 @@ int32_t glusterd_volinfo_copy_brick_portinfo (glusterd_volinfo_t *new_volinfo, glusterd_volinfo_t *old_volinfo) { - glusterd_brickinfo_t *new_brickinfo = NULL; - glusterd_brickinfo_t *old_brickinfo = NULL; + char pidfile[PATH_MAX+1] = {0,}; + glusterd_brickinfo_t *new_brickinfo = NULL; + glusterd_brickinfo_t *old_brickinfo = NULL; + glusterd_conf_t *priv = NULL; + int ret = 0; + xlator_t *this = NULL; - int ret = 0; GF_ASSERT (new_volinfo); GF_ASSERT (old_volinfo); + this = THIS; + GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); + if (_gf_false == glusterd_is_volume_started (new_volinfo)) goto out; + list_for_each_entry (new_brickinfo, &new_volinfo->bricks, brick_list) { ret = glusterd_volume_brickinfo_get (new_brickinfo->uuid, new_brickinfo->hostname, new_brickinfo->path, old_volinfo, &old_brickinfo); - if ((0 == ret) && glusterd_is_brick_started (old_brickinfo)) { - new_brickinfo->port = old_brickinfo->port; + if (ret == 0) { + GLUSTERD_GET_BRICK_PIDFILE (pidfile, old_volinfo, + old_brickinfo, priv); + if (gf_is_service_running (pidfile, NULL)) + new_brickinfo->port = old_brickinfo->port; + } } out: -- cgit