Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 May 2011 18:10:06 GMT
From:      dfilter@FreeBSD.ORG (dfilter service)
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/154504: commit references a PR
Message-ID:  <201105291810.p4TIA6IS081905@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: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/154504: commit references a PR
Date: Sun, 29 May 2011 18:01:06 +0000 (UTC)

 Author: trociny
 Date: Sun May 29 18:00:50 2011
 New Revision: 222454
 URL: http://svn.freebsd.org/changeset/base/222454
 
 Log:
   In soreceive_generic(), if MSG_WAITALL is set but the request is
   larger than the receive buffer, we have to receive in sections.
   When notifying the protocol that some data has been drained the
   lock is released for a moment. Returning we block waiting for the
   rest of data. There is a race, when data could arrive while the
   lock was released and then the connection stalls in sbwait.
   
   Fix this by checking for data before blocking and skip blocking
   if there are some.
   
   PR:		kern/154504
   Reported by:	Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
   Tested by:	Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
   Reviewed by:	rwatson
   Approved by:	kib (co-mentor)
   MFC after:	2 weeks
 
 Modified:
   head/sys/kern/uipc_socket.c
 
 Modified: head/sys/kern/uipc_socket.c
 ==============================================================================
 --- head/sys/kern/uipc_socket.c	Sun May 29 15:10:12 2011	(r222453)
 +++ head/sys/kern/uipc_socket.c	Sun May 29 18:00:50 2011	(r222454)
 @@ -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 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)
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105291810.p4TIA6IS081905>