From owner-svn-src-all@FreeBSD.ORG Tue Nov 16 07:09:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11CBA106566B; Tue, 16 Nov 2010 07:09:06 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA0398FC08; Tue, 16 Nov 2010 07:09:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAG795Pu043017; Tue, 16 Nov 2010 07:09:05 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAG7955Q043013; Tue, 16 Nov 2010 07:09:05 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011160709.oAG7955Q043013@svn.freebsd.org> From: Lawrence Stewart Date: Tue, 16 Nov 2010 07:09:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215377 - in head/sys/netinet: . cc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Nov 2010 07:09:06 -0000 Author: lstewart Date: Tue Nov 16 07:09:05 2010 New Revision: 215377 URL: http://svn.freebsd.org/changeset/base/215377 Log: cc_init() should only be run once on system boot, but with VIMAGE kernels it runs on boot and each time a vnet jail is created. Running cc_init() multiple times results in a panic when attempting to initialise the cc_list lock again, and so r215166 effectively broke the use of vnet jails. Switch to using a SYSINIT to run cc_init() on boot. CC algorithm modules loaded on boot register in the same SI_SUB_PROTO_IFATTACHDOMAIN category as is used in this patch, so cc_init() is run at SI_ORDER_FIRST to ensure the framework is initialised before module registration is attempted. Sponsored by: FreeBSD Foundation Reported and tested by: Mikolaj Golub MFC after: 11 weeks X-MFC with: r215166 Modified: head/sys/netinet/cc.h head/sys/netinet/cc/cc.c head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/cc.h ============================================================================== --- head/sys/netinet/cc.h Tue Nov 16 07:06:51 2010 (r215376) +++ head/sys/netinet/cc.h Tue Nov 16 07:09:05 2010 (r215377) @@ -62,7 +62,6 @@ extern struct cc_algo newreno_cc_algo; SYSCTL_DECL(_net_inet_tcp_cc); /* CC housekeeping functions. */ -void cc_init(void); int cc_register_algo(struct cc_algo *add_cc); int cc_deregister_algo(struct cc_algo *remove_cc); Modified: head/sys/netinet/cc/cc.c ============================================================================== --- head/sys/netinet/cc/cc.c Tue Nov 16 07:06:51 2010 (r215376) +++ head/sys/netinet/cc/cc.c Tue Nov 16 07:09:05 2010 (r215377) @@ -176,8 +176,8 @@ cc_list_available(SYSCTL_HANDLER_ARGS) /* * Initialise CC subsystem on system boot. */ -void -cc_init() +static void +cc_init(void) { CC_LIST_LOCK_INIT(); STAILQ_INIT(&cc_list); @@ -328,6 +328,8 @@ cc_modevent(module_t mod, int event_type return (err); } +SYSINIT(cc, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_FIRST, cc_init, NULL); + /* Declare sysctl tree and populate it. */ SYSCTL_NODE(_net_inet_tcp, OID_AUTO, cc, CTLFLAG_RW, NULL, "congestion control related settings"); Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Tue Nov 16 07:06:51 2010 (r215376) +++ head/sys/netinet/tcp_subr.c Tue Nov 16 07:09:05 2010 (r215377) @@ -278,8 +278,6 @@ tcp_init(void) { int hashsize; - cc_init(); - hashsize = TCBHASHSIZE; TUNABLE_INT_FETCH("net.inet.tcp.tcbhashsize", &hashsize); if (!powerof2(hashsize)) {