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