svn commit: r225365 - stable/8/sys/kern

Konstantin Belousov kib at FreeBSD.org
Sat Sep 3 08:31:59 UTC 2011


Author: kib
Date: Sat Sep  3 08:31:59 2011
New Revision: 225365
URL: http://svn.freebsd.org/changeset/base/225365

Log:
  MFC r225040:
  Prevent the hiwatermark for the unix domain socket from becoming
  effectively negative. Often seen as upstream fastcgi connection timeouts
  in nginx when using sendfile over unix domain sockets for communication.

Modified:
  stable/8/sys/kern/uipc_usrreq.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/kern/uipc_usrreq.c
==============================================================================
--- stable/8/sys/kern/uipc_usrreq.c	Sat Sep  3 08:08:24 2011	(r225364)
+++ stable/8/sys/kern/uipc_usrreq.c	Sat Sep  3 08:31:59 2011	(r225365)
@@ -776,7 +776,7 @@ uipc_send(struct socket *so, int flags, 
 	struct unpcb *unp, *unp2;
 	struct socket *so2;
 	u_int mbcnt_delta, sbcc;
-	u_long newhiwat;
+	u_int newhiwat;
 	int error = 0;
 
 	unp = sotounpcb(so);
@@ -911,7 +911,10 @@ uipc_send(struct socket *so, int flags, 
 		sorwakeup_locked(so2);
 
 		SOCKBUF_LOCK(&so->so_snd);
-		newhiwat = so->so_snd.sb_hiwat - (sbcc - unp2->unp_cc);
+		if ((int)so->so_snd.sb_hiwat >= (int)(sbcc - unp2->unp_cc))
+			newhiwat = so->so_snd.sb_hiwat - (sbcc - unp2->unp_cc);
+		else
+			newhiwat = 0;
 		(void)chgsbsize(so->so_cred->cr_uidinfo, &so->so_snd.sb_hiwat,
 		    newhiwat, RLIM_INFINITY);
 		so->so_snd.sb_mbmax -= mbcnt_delta;


More information about the svn-src-stable-8 mailing list