e3c68b
From e386fb4f4baf834e6a8fc25cc2fbbb17eb0a7a56 Mon Sep 17 00:00:00 2001
e3c68b
From: Mohammed Rafi KC <rkavunga@redhat.com>
e3c68b
Date: Thu, 20 Jun 2019 20:43:24 +0530
e3c68b
Subject: [PATCH 202/221] shd/mux: Fix race between mux_proc unlink and stop
e3c68b
e3c68b
There is a small race window, where we have a shd proc
e3c68b
without having a connection. That is when we stopped the
e3c68b
last shd running on a process. The list was removed
e3c68b
outside of a lock just after stopping the process.
e3c68b
e3c68b
So there is a window where we stopped the process, but
e3c68b
the shd proc list contains the entry.
e3c68b
e3c68b
Backport of: https://review.gluster.org/22909
e3c68b
e3c68b
>Change-Id: Id82a82509e5cd72acac24e8b7b87197626525441
e3c68b
>fixes: bz#1722541
e3c68b
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
e3c68b
e3c68b
Change-Id: I794131ede23f32fcfa5f71181149d8c1e7e439b8
e3c68b
BUG: 1721802
e3c68b
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
e3c68b
Reviewed-on: https://code.engineering.redhat.com/gerrit/174541
e3c68b
Tested-by: RHGS Build Bot <nigelb@redhat.com>
e3c68b
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
e3c68b
---
e3c68b
 xlators/mgmt/glusterd/src/glusterd-shd-svc.c | 3 +++
e3c68b
 1 file changed, 3 insertions(+)
e3c68b
e3c68b
diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
e3c68b
index d81d760..dbe2560 100644
e3c68b
--- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
e3c68b
+++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
e3c68b
@@ -694,6 +694,9 @@ glusterd_shdsvc_stop(glusterd_svc_t *svc, int sig)
e3c68b
         gf_is_service_running(svc->proc.pidfile, &pid;;
e3c68b
         cds_list_del_init(&svc->mux_svc);
e3c68b
         empty = cds_list_empty(&svc_proc->svcs);
e3c68b
+        if (empty) {
e3c68b
+            cds_list_del_init(&svc_proc->svc_proc_list);
e3c68b
+        }
e3c68b
     }
e3c68b
     pthread_mutex_unlock(&conf->attach_lock);
e3c68b
     if (empty) {
e3c68b
-- 
e3c68b
1.8.3.1
e3c68b