From f87c8878e6d8b0b8cfc898357be34644776894b7 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Mon, 8 Dec 2014 16:33:18 +0000 Subject: [PATCH] Current reaction of the nfsd worker threads to any signal is exit. This is not correct at least for the stop requests. Check for stop conditions and suspend threads if requested. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/rpc/svc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/sys/rpc/svc.c b/sys/rpc/svc.c index 95d4c49c1ab..75d9d6edce7 100644 --- a/sys/rpc/svc.c +++ b/sys/rpc/svc.c @@ -1101,6 +1101,7 @@ svc_run_internal(SVCGROUP *grp, bool_t ismaster) SVCXPRT *xprt; enum xprt_stat stat; struct svc_req *rqstp; + struct proc *p; size_t sz; int error; @@ -1183,11 +1184,22 @@ svc_run_internal(SVCGROUP *grp, bool_t ismaster) > grp->sg_minthreads) && !st->st_xprt) break; - } else if (error) { + } else if (error != 0) { + KASSERT(error == EINTR || error == ERESTART, + ("non-signal error %d", error)); mtx_unlock(&grp->sg_lock); - svc_exit(pool); - mtx_lock(&grp->sg_lock); - break; + p = curproc; + PROC_LOCK(p); + if (P_SHOULDSTOP(p)) { + thread_suspend_check(0); + PROC_UNLOCK(p); + mtx_lock(&grp->sg_lock); + } else { + PROC_UNLOCK(p); + svc_exit(pool); + mtx_lock(&grp->sg_lock); + break; + } } continue; }