diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2024-01-12 08:47:47 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2024-01-12 08:47:47 +0000 |
commit | 723452bd35c53d1437fa7192a7d7935be6be4a8e (patch) | |
tree | 096f22d933891306efd084eb05bccde2435f73b2 /sys/nfs/nfs_syscalls.c | |
parent | c936d21ceee5b01f5dbfec8ddf338ec38ce8077c (diff) |
nfssvc: When the client disconnects, close the socket before sleeping.
If the server doesn't close the socket immediately and starts waiting
for the client to reconnect, then the TCP connection will remain open.
The client will have to wait for the connection to be closed in order
to reconnect with the same source port; this never happens, resulting
in a freeze until the file system is umounted.
This change fixes Linux NFS clients freezing after 5 min of inactivity.
ok miod, help from claudio
Diffstat (limited to 'sys/nfs/nfs_syscalls.c')
-rw-r--r-- | sys/nfs/nfs_syscalls.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c index 45ff763af20..b19bc3653b3 100644 --- a/sys/nfs/nfs_syscalls.c +++ b/sys/nfs/nfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_syscalls.c,v 1.119 2023/08/03 09:49:09 mvs Exp $ */ +/* $OpenBSD: nfs_syscalls.c,v 1.120 2024/01/12 08:47:46 ratchov Exp $ */ /* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */ /* @@ -331,14 +331,15 @@ loop: slp = nfsd->nfsd_slp; if (ISSET(slp->ns_flag, SLP_VALID)) { - if (ISSET(slp->ns_flag, SLP_DISCONN)) { - nfsrv_zapsock(slp); - } else if (ISSET(slp->ns_flag, SLP_NEEDQ)) { + if ((slp->ns_flag & (SLP_DISCONN | SLP_NEEDQ)) == + SLP_NEEDQ) { CLR(slp->ns_flag, SLP_NEEDQ); nfs_sndlock(&slp->ns_solock, NULL); nfsrv_rcv(slp->ns_so, (caddr_t)slp, M_WAIT); nfs_sndunlock(&slp->ns_solock); } + if (ISSET(slp->ns_flag, SLP_DISCONN)) + nfsrv_zapsock(slp); error = nfsrv_dorec(slp, nfsd, &nd); SET(nfsd->nfsd_flag, NFSD_REQINPROG); |