The NFS subsystem is not MP-safe yet. Take this into account
in the NFS server socket upcall by locking the kernel.
This might help with the NFS server hanging that was seen recently
as a result of the now-reverted selwakeup()-to-KNOTE() conversion.
Unfortunately, I have not been able to confirm this myself.
OK?
Index: nfs/nfs_socket.c
===================================================================
RCS file: src/sys/nfs/nfs_socket.c,v
retrieving revision 1.140
diff -u -p -r1.140 nfs_socket.c
--- nfs/nfs_socket.c 17 Mar 2022 14:23:34 -0000 1.140
+++ nfs/nfs_socket.c 13 May 2022 15:38:48 -0000
@@ -1561,8 +1561,10 @@ nfsrv_rcv(struct socket *so, caddr_t arg
struct uio auio;
int flags, error;
+ KERNEL_LOCK();
+
if ((slp->ns_flag & SLP_VALID) == 0)
- return;
+ goto out;
/* Defer soreceive() to an nfsd. */
if (waitflag == M_DONTWAIT) {
@@ -1644,6 +1646,9 @@ dorecs:
if (waitflag == M_DONTWAIT &&
(slp->ns_rec || (slp->ns_flag & (SLP_NEEDQ | SLP_DISCONN))))
nfsrv_wakenfsd(slp);
+
+out:
+ KERNEL_UNLOCK();
}
/*