Date: Sat, 3 Sep 2011 08:31:59 +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-8@freebsd.org Subject: svn commit: r225365 - stable/8/sys/kern Message-ID: <201109030831.p838Vxka037011@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109030831.p838Vxka037011>