Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Nov 2009 12:09:21 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r199358 - stable/7/sys/kern
Message-ID:  <200911171209.nAHC9Lm7006111@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Nov 17 12:09:21 2009
New Revision: 199358
URL: http://svn.freebsd.org/changeset/base/199358

Log:
  MFC r198853:
  If socket buffer space appears to be lower then sum of count of
  already prepared bytes and next portion of transfer, inner loop of
  kern_sendfile() aborts, not preparing next mbuf for socket buffer, and
  not modifying any outer loop invariants. The thread loops in the outer
  loop forever.
  
  Instead of breaking from inner loop, prepare only bytes that fit into
  the socket buffer space.

Modified:
  stable/7/sys/kern/uipc_syscalls.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/uipc_syscalls.c
==============================================================================
--- stable/7/sys/kern/uipc_syscalls.c	Tue Nov 17 11:46:55 2009	(r199357)
+++ stable/7/sys/kern/uipc_syscalls.c	Tue Nov 17 12:09:21 2009	(r199358)
@@ -2027,20 +2027,12 @@ retry_space:
 				rem = obj->un_pager.vnp.vnp_size -
 				    uap->offset - fsbytes - loopbytes;
 			xfsize = omin(rem, xfsize);
+			xfsize = omin(space - loopbytes, xfsize);
 			if (xfsize <= 0) {
 				VM_OBJECT_UNLOCK(obj);
 				done = 1;		/* all data sent */
 				break;
 			}
-			/*
-			 * Don't overflow the send buffer.
-			 * Stop here and send out what we've
-			 * already got.
-			 */
-			if (space < loopbytes + xfsize) {
-				VM_OBJECT_UNLOCK(obj);
-				break;
-			}
 
 			/*
 			 * Attempt to look up the page.  Allocate



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