Blob Blame History Raw
From 0be3673b1024a9a28e56dc4b4d06e0b61651cc59 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Thu, 30 Mar 2017 14:47:45 +0530
Subject: [PATCH 365/369] glusterd: reset pid to -1 if brick is not online

While populating brick details in gluster volume status response payload
if a brick is not online then pid should be reset back to -1 so that
volume status output doesn't show up the pid which was not cleaned up
especially with brick multiplexing where multiple bricks belong to same
process.

>Reviewed-on: https://review.gluster.org/16971
>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: Gaurav Yadav <gyadav@redhat.com>
>Reviewed-by: Prashanth Pai <ppai@redhat.com>
>Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>

Change-Id: Iba346da9a8cb5b5f5dd38031d4c5ef2097808387
BUG: 1438051
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/102296
---
 xlators/mgmt/glusterd/src/glusterd-utils.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 4e15603..77f97a5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -6314,6 +6314,8 @@ glusterd_add_brick_to_dict (glusterd_volinfo_t *volinfo,
         if (glusterd_is_brick_started (brickinfo)) {
                 if (gf_is_service_running (pidfile, &pid)) {
                         brick_online = _gf_true;
+                } else {
+                        pid = -1;
                 }
         }
 
-- 
1.8.3.1