From owner-cvs-all@FreeBSD.ORG Thu Jan 31 08:22:25 2008 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BAAA16A420; Thu, 31 Jan 2008 08:22:25 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 4131413C4CE; Thu, 31 Jan 2008 08:22:25 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m0V8MP0f083518; Thu, 31 Jan 2008 08:22:25 GMT (envelope-from rwatson@repoman.freebsd.org) Received: (from rwatson@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m0V8MPBV083517; Thu, 31 Jan 2008 08:22:25 GMT (envelope-from rwatson) Message-Id: <200801310822.m0V8MPBV083517@repoman.freebsd.org> From: Robert Watson Date: Thu, 31 Jan 2008 08:22:25 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/sys socketvar.h src/sys/kern uipc_sockbuf.c uipc_socket.c uipc_syscalls.c src/sys/netinet sctp_input.c sctp_peeloff.c sctputil.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2008 08:22:25 -0000 rwatson 2008-01-31 08:22:25 UTC FreeBSD src repository Modified files: sys/sys socketvar.h sys/kern uipc_sockbuf.c uipc_socket.c uipc_syscalls.c sys/netinet sctp_input.c sctp_peeloff.c sctputil.c Log: Correct two problems relating to sorflush(), which is called to flush read socket buffers in shutdown() and close(): - Call socantrcvmore() before sblock() to dislodge any threads that might be sleeping (potentially indefinitely) while holding sblock(), such as a thread blocked in recv(). - Flag the sblock() call as non-interruptible so that a signal delivered to the thread calling sorflush() doesn't cause sblock() to fail. The sblock() is required to ensure that all other socket consumer threads have, in fact, left, and do not enter, the socket buffer until we're done flushin it. To implement the latter, change the 'flags' argument to sblock() to accept two flags, SBL_WAIT and SBL_NOINTR, rather than one M_WAITOK flag. When SBL_NOINTR is set, it forces a non-interruptible sx acquisition, regardless of the setting of the disposition of SB_NOINTR on the socket buffer; without this change it would be possible for another thread to clear SB_NOINTR between when the socket buffer mutex is released and sblock() is invoked. Reviewed by: bz, kmacy Reported by: Jos Backus Revision Changes Path 1.175 +6 -2 src/sys/kern/uipc_sockbuf.c 1.304 +11 -5 src/sys/kern/uipc_socket.c 1.264 +7 -2 src/sys/kern/uipc_syscalls.c 1.67 +2 -1 src/sys/netinet/sctp_input.c 1.17 +2 -2 src/sys/netinet/sctp_peeloff.c 1.73 +1 -1 src/sys/netinet/sctputil.c 1.161 +7 -0 src/sys/sys/socketvar.h