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 <to.my.trociny at gmail com>
  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)) {
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to