a3470f
From 747262000fd282ba66b7b1ffd7c51553d8f60de9 Mon Sep 17 00:00:00 2001
a3470f
From: Sanju Rakonde <srakonde@redhat.com>
a3470f
Date: Fri, 8 Jun 2018 19:39:58 +0530
a3470f
Subject: [PATCH 298/305] glusterd: Fix for shd not coming up
a3470f
a3470f
Problem: After creating and starting n(n is large) distribute-replicated
a3470f
volumes using a script, if we create and start (n+1)th distribute-replicate
a3470f
volume manually self heal daemon is down.
a3470f
a3470f
Solution: In glusterd_proc_stop after giving SIGTERM signal if the
a3470f
process is still running, we are giving a SIGKILL. As SIGKILL will
a3470f
not perform any cleanup process, we need to remove the pidfile.
a3470f
a3470f
>Fixes: bz#1589253
a3470f
>Change-Id: I7c114334eec74c8d0f21b3e45cf7db6b8ef28af1
a3470f
>Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
a3470f
a3470f
upstream patch: https://review.gluster.org/#/c/20197/
a3470f
a3470f
Change-Id: I7c114334eec74c8d0f21b3e45cf7db6b8ef28af1
a3470f
BUG: 1581184
a3470f
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/141526
a3470f
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
---
a3470f
 libglusterfs/src/common-utils.c                | 3 ---
a3470f
 xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c | 4 ++++
a3470f
 2 files changed, 4 insertions(+), 3 deletions(-)
a3470f
a3470f
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
a3470f
index 378ed05..fd2f004 100644
a3470f
--- a/libglusterfs/src/common-utils.c
a3470f
+++ b/libglusterfs/src/common-utils.c
a3470f
@@ -3854,9 +3854,6 @@ gf_is_service_running (char *pidfile, int *pid)
a3470f
         ret = lockf (fno, F_TEST, 0);
a3470f
         if (ret == -1)
a3470f
                 running = _gf_true;
a3470f
-        if (!pid) {
a3470f
-                goto out;
a3470f
-        }
a3470f
 
a3470f
         ret = fscanf (file, "%d", pid);
a3470f
         if (ret <= 0) {
a3470f
diff --git a/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c
a3470f
index 8eeec40..ebf4174 100644
a3470f
--- a/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c
a3470f
+++ b/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c
a3470f
@@ -12,6 +12,7 @@
a3470f
 #include <limits.h>
a3470f
 #include <signal.h>
a3470f
 
a3470f
+#include "glusterd-utils.h"
a3470f
 #include "common-utils.h"
a3470f
 #include "xlator.h"
a3470f
 #include "logging.h"
a3470f
@@ -113,6 +114,9 @@ glusterd_proc_stop (glusterd_proc_t *proc, int sig, int flags)
a3470f
                                 "reason:%s", pid, strerror(errno));
a3470f
                         goto out;
a3470f
                 }
a3470f
+                ret = glusterd_unlink_file (proc->pidfile);
a3470f
+                if (ret)
a3470f
+                        goto out;
a3470f
         }
a3470f
 
a3470f
         ret = 0;
a3470f
-- 
a3470f
1.8.3.1
a3470f