256ebe
From fe9159ee42f0f67b01e6a495df8105ea0f66738d Mon Sep 17 00:00:00 2001
256ebe
From: Mohammed Rafi KC <rkavunga@redhat.com>
256ebe
Date: Thu, 30 May 2019 23:48:05 +0530
256ebe
Subject: [PATCH 183/192] glusterd/svc: Stop stale process using the
256ebe
 glusterd_proc_stop
256ebe
256ebe
While restarting a glusterd process, when we have a stale pid
256ebe
we were doing a simple kill. Instead we can use glusterd_proc_stop
256ebe
Because it has more logging plus force kill in case if there is
256ebe
any problem with kill signal handling.
256ebe
256ebe
Upstream patch: https://review.gluster.org/#/c/glusterfs/+/22791/
256ebe
256ebe
>Change-Id: I4a2dadc210a7a65762dd714e809899510622b7ec
256ebe
>updates: bz#1710054
256ebe
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
256ebe
256ebe
Change-Id: I3327528d8ebf90bbb2221265a0cf059c9359f141
256ebe
BUG: 1720248
256ebe
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
256ebe
Reviewed-on: https://code.engineering.redhat.com/gerrit/172290
256ebe
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
256ebe
Tested-by: RHGS Build Bot <nigelb@redhat.com>
256ebe
---
256ebe
 xlators/mgmt/glusterd/src/glusterd-svc-helper.c | 6 +++---
256ebe
 1 file changed, 3 insertions(+), 3 deletions(-)
256ebe
256ebe
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
256ebe
index 6a3ca52..a6e662f 100644
256ebe
--- a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
256ebe
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
256ebe
@@ -488,9 +488,9 @@ glusterd_shd_svc_mux_init(glusterd_volinfo_t *volinfo, glusterd_svc_t *svc)
256ebe
 
256ebe
             if (!mux_proc) {
256ebe
                 if (pid != -1 && sys_access(svc->proc.pidfile, R_OK) == 0) {
256ebe
-                    /* stale pid file, unlink it. */
256ebe
-                    kill(pid, SIGTERM);
256ebe
-                    sys_unlink(svc->proc.pidfile);
256ebe
+                    /* stale pid file, stop and unlink it */
256ebe
+                    glusterd_proc_stop(&svc->proc, SIGTERM, PROC_STOP_FORCE);
256ebe
+                    glusterd_unlink_file(svc->proc.pidfile);
256ebe
                 }
256ebe
                 mux_proc = __gf_find_compatible_svc(GD_NODE_SHD);
256ebe
             }
256ebe
-- 
256ebe
1.8.3.1
256ebe