Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Apr 2011 16:49:25 +0300
From:      Mikolaj Golub <trociny@freebsd.org>
To:        Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
Cc:        Kostik Belousov <kib@FreeBSD.org>, freebsd-net@freebsd.org, Pawel Jakub Dawidek <pjd@FreeBSD.org>, bug-followup@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:  <86sjtqw716.fsf@kopusha.home.net>

next in thread | raw e-mail | index | archive | help
--=-=-=

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?86sjtqw716.fsf>