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