summaryrefslogtreecommitdiff
path: root/sys/nfs/nfs_socket.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-03-03 09:41:21 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-03-03 09:41:21 +0000
commiteba2d629bf403623d0bc5636350e9d78f049e8b0 (patch)
treeedfab56d41f61aa0f810f06fb86276f9fd2f2098 /sys/nfs/nfs_socket.c
parentfd55d4d03b161daa8ece6c47929caa2f0e77eb6e (diff)
Prevent a recursion in the socket layer.
Always defere soreceive() to an nfsd(8) process instead of doing it in the 'softnet' thread. Avoiding this recursion ensure that we do not introduce a new sleeping point by releasing and grabbing the netlock. Tested by many, committing now in order to find possible performance regression.
Diffstat (limited to 'sys/nfs/nfs_socket.c')
-rw-r--r--sys/nfs/nfs_socket.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index 4abf85c41cf..c562aae7327 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_socket.c,v 1.113 2017/02/22 11:42:46 mpi Exp $ */
+/* $OpenBSD: nfs_socket.c,v 1.114 2017/03/03 09:41:20 mpi Exp $ */
/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
/*
@@ -1580,27 +1580,16 @@ nfsrv_rcv(struct socket *so, caddr_t arg, int waitflag)
if ((slp->ns_flag & SLP_VALID) == 0)
return;
-#ifdef notdef
- /*
- * Define this to test for nfsds handling this under heavy load.
- */
+
+ /* Defer soreceive() to an nfsd. */
if (waitflag == M_DONTWAIT) {
- slp->ns_flag |= SLP_NEEDQ; goto dorecs;
+ slp->ns_flag |= SLP_NEEDQ;
+ goto dorecs;
}
-#endif
+
auio.uio_procp = NULL;
if (so->so_type == SOCK_STREAM) {
/*
- * If there are already records on the queue, defer soreceive()
- * to an nfsd so that there is feedback to the TCP layer that
- * the nfs servers are heavily loaded.
- */
- if (slp->ns_rec && waitflag == M_DONTWAIT) {
- slp->ns_flag |= SLP_NEEDQ;
- goto dorecs;
- }
-
- /*
* Do soreceive().
*/
auio.uio_resid = 1000000000;