a3470f
From b55e9f05cb457806d08ac184de4b5651e420f11e Mon Sep 17 00:00:00 2001
a3470f
From: Mohit Agrawal <moagrawal@redhat.com>
a3470f
Date: Mon, 27 Aug 2018 12:18:21 +0530
a3470f
Subject: [PATCH 362/362] glusterd: glusterd_brick_start shouldn't cleanup
a3470f
 pidfile if only_connect is true
a3470f
a3470f
Problem: Sometime glusterd cleanup pidfile even brick is started
a3470f
         and cli shows volume status "N/A"
a3470f
a3470f
Solution: Update the condition in glusterd_brick_start to avoid
a3470f
          pidfile cleanup in case if only_connect flag is true
a3470f
a3470f
> Fixes: bz#1622422
a3470f
> Change-Id: I8decb34597126b848e3a44d957e138833dd97350
a3470f
> (cherry picked from commit 1b499e9dfe63ce051a071cacc19e3161b7a32636)
a3470f
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/21007/)
a3470f
a3470f
Change-Id: Id9145c26de15cf2354a10a482b5f8a45599e0831
a3470f
BUG: 1622452
a3470f
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/148184
a3470f
Tested-by: Mohit Agrawal <moagrawa@redhat.com>
a3470f
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
a3470f
---
a3470f
 xlators/mgmt/glusterd/src/glusterd-utils.c | 8 ++++----
a3470f
 1 file changed, 4 insertions(+), 4 deletions(-)
a3470f
a3470f
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
a3470f
index b9e8d8d..01345cd 100644
a3470f
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
a3470f
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
a3470f
@@ -6163,6 +6163,8 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
a3470f
                         brickpath = search_brick_path_from_proc
a3470f
                                                 (pid, brickinfo->path);
a3470f
                         if (!brickpath) {
a3470f
+                                if (only_connect)
a3470f
+                                        return 0;
a3470f
                                 gf_log (this->name, GF_LOG_INFO,
a3470f
                                         "Either pid %d is not running or brick"
a3470f
                                         " path %s is not consumed so cleanup pidfile",
a3470f
@@ -6173,14 +6175,14 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
a3470f
                                 if (sys_access (pidfile , R_OK) == 0) {
a3470f
                                         sys_unlink (pidfile);
a3470f
                                 }
a3470f
-                                if (only_connect)
a3470f
-                                        return 0;
a3470f
                                 goto run;
a3470f
                         }
a3470f
                         GF_FREE (brickpath);
a3470f
                         ret = glusterd_get_sock_from_brick_pid (pid, socketpath,
a3470f
                                                                 sizeof(socketpath));
a3470f
                         if (ret) {
a3470f
+                                if (only_connect)
a3470f
+                                        return 0;
a3470f
                                 gf_log (this->name, GF_LOG_INFO,
a3470f
                                         "Either pid %d is not running or does "
a3470f
                                         "not match with any running brick "
a3470f
@@ -6189,8 +6191,6 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
a3470f
                                 if (sys_access (pidfile , R_OK) == 0) {
a3470f
                                         sys_unlink (pidfile);
a3470f
                                 }
a3470f
-                                if (only_connect)
a3470f
-                                        return 0;
a3470f
                                 goto run;
a3470f
                         }
a3470f
                 }
a3470f
-- 
a3470f
1.8.3.1
a3470f