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