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