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