From 1d0db2e1548ff08cac93e3a5c735a73b92e18791 Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Garg Date: Thu, 21 May 2015 17:13:54 +0530 Subject: 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. Change-Id: I077100d96de381695b338382808bd8c37bf625c7 BUG: 1228065 Signed-off-by: Gaurav Kumar Garg Reviewed-on: http://review.gluster.org/10877 Tested-by: Gluster Build System Reviewed-by: Anand Nekkunti Reviewed-by: Atin Mukherjee Tested-by: NetBSD Build System Reviewed-by: Krishnan Parthasarathi (cherry picked from commit 1a0d76fa14ee88ce17e017c3ceb311417870e944) Reviewed-on: http://review.gluster.org/11080 --- xlators/mgmt/glusterd/src/glusterd-utils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'xlators/mgmt/glusterd') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index f90abc19b2e..86b22f8efbe 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); -- cgit