HomeFreeBSD

nfsd: fix a NFSv4.1 Linux client mount stuck in CLOSE_WAIT

Description

nfsd: fix a NFSv4.1 Linux client mount stuck in CLOSE_WAIT

It was reported that a NFSv4.1 Linux client mount against
a FreeBSD12 server was hung, with the TCP connection in
CLOSE_WAIT state on the server.
When a NFSv4.1/4.2 mount is done and the back channel is
bound to the TCP connection, the soclose() is delayed until
a new TCP connection is bound to the back channel, due to
a reference count being held on the SVCXPRT structure in
the krpc for the socket. Without the soclose() call, the socket
will remain in CLOSE_WAIT and this somehow caused the Linux
client to hang.

This patch adds calls to soshutdown(.., SHUT_WR) that
are performed when the server side krpc sees that the
socket is no longer usable. Since this can be done
before the back channel is bound to a new TCP connection,
it allows the TCP connection to proceed to CLOSED state.

PR: 254590
(cherry picked from commit db8c27f499105dcc9872dcc46e88bdd570c24fee)

Details

Provenance
rmacklemAuthored on Apr 27 2021, 10:32 PM
Parents
rG2bad237ec94f: nfsclient: Copy only initialized fields in nfs_getattr()
Branches
Unknown
Tags
Unknown