Re: git: fb901935f257 - main - socket: Split up sosend_generic()
Date: Tue, 20 Aug 2024 14:50:31 UTC
On Tue, Aug 20, 2024 at 07:37:30AM -0700, Cy Schubert wrote:
> In message <202408191437.47JEbhOG094258@gitrepo.freebsd.org>, Mark Johnston
> wri
> tes:
> > The branch main has been updated by markj:
> >
> > URL: https://cgit.FreeBSD.org/src/commit/?id=fb901935f257ddcc492fe9efb605797f
> > 181c6597
> >
> > commit fb901935f257ddcc492fe9efb605797f181c6597
> > Author: Mark Johnston <markj@FreeBSD.org>
> > AuthorDate: 2024-08-19 14:20:43 +0000
> > Commit: Mark Johnston <markj@FreeBSD.org>
> > CommitDate: 2024-08-19 14:37:27 +0000
> >
> > socket: Split up sosend_generic()
> >
> > Factor out the bits that run with the sock I/O lock held into a separate
> > function. In this implementation, we are doing a bit more work under
> > the I/O lock than before. However, lock contention is only a problem
> > when multiple threads are transmitting on the same socket, which is an
> > unusual case that is not expected to perform well in any case.
> >
> > No functional change intended.
> >
> > Reviewed by: gallatin, glebius
> > MFC after: 2 weeks
> > Sponsored by: Klara, Inc.
> > Sponsored by: Stormshield
> > Differential Revision: https://reviews.freebsd.org/D46305
> > ---
> > sys/kern/uipc_socket.c | 47 +++++++++++++++++++++++++++++------------------
> > 1 file changed, 29 insertions(+), 18 deletions(-)
> >
> > [...]
>
> This commit broke NFS over TCP (V3 and V4). It it results in random
> unrecoverable hangs of an NFS share.
>
> My test is to installworld/installkernel over NFS from my main build server.
>
> All the other socket commits in this series had no adverse affect on NFS
> over TCP.
Does the patch below fix this for you?
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 13b6253bd115..42c43539b484 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1920,7 +1920,7 @@ sosend_generic(struct socket *so, struct sockaddr *addr, struct uio *uio,
{
int error;
- error = SOCK_IO_SEND_LOCK(so, 0);
+ error = SOCK_IO_SEND_LOCK(so, SBLOCKWAIT(flags));
if (error)
return (error);
error = sosend_generic_locked(so, addr, uio, top, control, flags, td);