Date: Sun, 10 Apr 2011 13:50:13 GMT From: Mikolaj Golub <trociny@freebsd.org> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/154504: [libc] recv(2): PF_LOCAL stream connection is stuck in sbwait when recv(MSG_WAITALL) is used Message-ID: <201104101350.p3ADoD6f026799@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/154504; it has been noted by GNATS.
From: Mikolaj Golub <trociny@freebsd.org>
To: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
Cc: bug-followup@FreeBSD.org, freebsd-net@freebsd.org,
Pawel Jakub Dawidek <pjd@FreeBSD.org>, Kostik Belousov <kib@FreeBSD.org>
Subject: Re: kern/154504: [libc] recv(2): PF_LOCAL stream connection is stuck in sbwait when recv(MSG_WAITALL) is used
Date: Sun, 10 Apr 2011 16:49:25 +0300
--=-=-=
Hi,
Does the attached patch fix the problem for you?
--
Mikolaj Golub
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=uipc_socket.c.soreceive.patch
Index: sys/kern/uipc_socket.c
===================================================================
--- sys/kern/uipc_socket.c (revision 220485)
+++ sys/kern/uipc_socket.c (working copy)
@@ -1845,10 +1845,16 @@ dontblock:
}
SBLASTRECORDCHK(&so->so_rcv);
SBLASTMBUFCHK(&so->so_rcv);
- error = sbwait(&so->so_rcv);
- if (error) {
- SOCKBUF_UNLOCK(&so->so_rcv);
- goto release;
+ /*
+ * We could receive some data while was notifying the
+ * the protocol. Skip blocking in this case.
+ */
+ if (so->so_rcv.sb_mb == NULL) {
+ error = sbwait(&so->so_rcv);
+ if (error) {
+ SOCKBUF_UNLOCK(&so->so_rcv);
+ goto release;
+ }
}
m = so->so_rcv.sb_mb;
if (m != NULL)
--=-=-=--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104101350.p3ADoD6f026799>
