From eedc3bf07a6ce161ef65e17459c2ce440b498f30 Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Garg Date: Thu, 21 May 2015 17:13:54 +0530 Subject: [PATCH 07/18] glusterd: do not show pid of brick in volume status if brick is down. glusterd is currently showing pid of brick in volume status if brick goes down. It should not show pid of brick if brick is down. BUG: 1223715 Change-Id: I65fd5a20a8f60159a71e00914a72ece99168ed9c Signed-off-by: Gaurav Kumar Garg upstream-review-url: Reviewed-on: http://review.gluster.org/11080 Reviewed-on: https://code.engineering.redhat.com/gerrit/50098 Reviewed-by: Atin Mukherjee Tested-by: Atin Mukherjee --- xlators/mgmt/glusterd/src/glusterd-utils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index f90abc19..86b22f8 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -5170,12 +5170,12 @@ glusterd_add_brick_to_dict (glusterd_volinfo_t *volinfo, int ret = -1; int32_t pid = -1; - int32_t brick_online = -1; char key[1024] = {0}; char base_key[1024] = {0}; char pidfile[PATH_MAX] = {0}; xlator_t *this = NULL; glusterd_conf_t *priv = NULL; + gf_boolean_t brick_online = _gf_false; GF_ASSERT (volinfo); GF_ASSERT (brickinfo); @@ -5230,7 +5230,9 @@ glusterd_add_brick_to_dict (glusterd_volinfo_t *volinfo, GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, brickinfo, priv); - brick_online = gf_is_service_running (pidfile, &pid); + if (glusterd_is_brick_started (brickinfo)) { + brick_online = gf_is_service_running (pidfile, &pid); + } memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "%s.pid", base_key); -- 1.9.3