svn commit: r275618 - head/sys/rpc

Konstantin Belousov kib at FreeBSD.org
Mon Dec 8 16:33:19 UTC 2014


Author: kib
Date: Mon Dec  8 16:33:18 2014
New Revision: 275618
URL: https://svnweb.freebsd.org/changeset/base/275618

Log:
  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

Modified:
  head/sys/rpc/svc.c

Modified: head/sys/rpc/svc.c
==============================================================================
--- head/sys/rpc/svc.c	Mon Dec  8 16:27:43 2014	(r275617)
+++ head/sys/rpc/svc.c	Mon Dec  8 16:33:18 2014	(r275618)
@@ -1101,6 +1101,7 @@ svc_run_internal(SVCGROUP *grp, bool_t i
 	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 i
 					> 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;
 		}


More information about the svn-src-all mailing list