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