From 665d627e865d8cfa6a454c2c79eed9e9a1276865 Mon Sep 17 00:00:00 2001 From: Mohammed Rafi KC Date: Thu, 20 Jun 2019 20:43:24 +0530 Subject: shd/mux: Fix race between mux_proc unlink and stop There is a small race window, where we have a shd proc without having a connection. That is when we stopped the last shd running on a process. The list was removed outside of a lock just after stopping the process. So there is a window where we stopped the process, but the shd proc list contains the entry. Change-Id: Id82a82509e5cd72acac24e8b7b87197626525441 fixes: bz#1722541 Signed-off-by: Mohammed Rafi KC --- xlators/mgmt/glusterd/src/glusterd-shd-svc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c index ebf7e3a8e6b..f6999e3ec4c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c @@ -696,6 +696,9 @@ glusterd_shdsvc_stop(glusterd_svc_t *svc, int sig) } cds_list_del_init(&svc->mux_svc); empty = cds_list_empty(&svc_proc->svcs); + if (empty) { + cds_list_del_init(&svc_proc->svc_proc_list); + } } pthread_mutex_unlock(&conf->attach_lock); if (empty) { -- cgit