From owner-svn-src-stable-7@FreeBSD.ORG Tue Oct 14 07:58:19 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50DF4106568F; Tue, 14 Oct 2008 07:58:19 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3DBE18FC14; Tue, 14 Oct 2008 07:58:19 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9E7wJWG099363; Tue, 14 Oct 2008 07:58:19 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9E7wJD1099361; Tue, 14 Oct 2008 07:58:19 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200810140758.m9E7wJD1099361@svn.freebsd.org> From: Robert Watson Date: Tue, 14 Oct 2008 07:58:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183870 - in stable/7/sys: . kern netinet X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2008 07:58:19 -0000 Author: rwatson Date: Tue Oct 14 07:58:18 2008 New Revision: 183870 URL: http://svn.freebsd.org/changeset/base/183870 Log: Merge r183662 and r183663 from head to stable/7: Don't pass curthread to sbreserve_locked() in tcp_do_segment(), as the netisr or ithread's socket buffer size limit is not the right limit to use. Instead, pass NULL as the other two calls to sbreserve_locked() in the TCP input path (tcp_mss()) do. In practice, this is a no-op, as ithreads and the netisr run without a process limit on socket buffer use, and a NULL thread pointer leads to not using the process's limit, if any. However, if tcp_input() is called in other contexts that do have limits, this may prevent the incorrect limit from being used. Rewrite sbreserve_locked()'s comment on NULL thread pointers, eliminating an XXXRW about the comment being stale. Approved by: re (gnn) Modified: stable/7/sys/ (props changed) stable/7/sys/kern/uipc_sockbuf.c stable/7/sys/netinet/tcp_input.c Modified: stable/7/sys/kern/uipc_sockbuf.c ============================================================================== --- stable/7/sys/kern/uipc_sockbuf.c Tue Oct 14 07:52:47 2008 (r183869) +++ stable/7/sys/kern/uipc_sockbuf.c Tue Oct 14 07:58:18 2008 (r183870) @@ -283,10 +283,11 @@ sbreserve_locked(struct sockbuf *sb, u_l SOCKBUF_LOCK_ASSERT(sb); /* - * td will only be NULL when we're in an interrupt (e.g. in - * tcp_input()). - * - * XXXRW: This comment needs updating, as might the code. + * When a thread is passed, we take into account the thread's socket + * buffer size limit. The caller will generally pass curthread, but + * in the TCP input path, NULL will be passed to indicate that no + * appropriate thread resource limits are available. In that case, + * we don't apply a process limit. */ if (cc > sb_max_adj) return (0); Modified: stable/7/sys/netinet/tcp_input.c ============================================================================== --- stable/7/sys/netinet/tcp_input.c Tue Oct 14 07:52:47 2008 (r183869) +++ stable/7/sys/netinet/tcp_input.c Tue Oct 14 07:58:18 2008 (r183870) @@ -1215,7 +1215,7 @@ tcp_do_segment(struct mbuf *m, struct tc */ if (newsize) if (!sbreserve_locked(&so->so_rcv, - newsize, so, curthread)) + newsize, so, NULL)) so->so_rcv.sb_flags &= ~SB_AUTOSIZE; m_adj(m, drop_hdrlen); /* delayed header drop */ sbappendstream_locked(&so->so_rcv, m);