From owner-svn-src-stable-8@FreeBSD.ORG Sat Sep 3 08:31:59 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF2A6106566C; Sat, 3 Sep 2011 08:31:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF2718FC08; Sat, 3 Sep 2011 08:31:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p838Vxqh037013; Sat, 3 Sep 2011 08:31:59 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p838Vxka037011; Sat, 3 Sep 2011 08:31:59 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201109030831.p838Vxka037011@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 3 Sep 2011 08:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225365 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Sep 2011 08:31:59 -0000 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;