Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Dec 2014 16:33:18 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r275618 - head/sys/rpc
Message-ID:  <201412081633.sB8GXIwl002211@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412081633.sB8GXIwl002211>