diff options
author | lstewart <lstewart@FreeBSD.org> | 2010-11-16 07:09:05 +0000 |
---|---|---|
committer | lstewart <lstewart@FreeBSD.org> | 2010-11-16 07:09:05 +0000 |
commit | c28db57abb39d3a184fc1946ad3108a57c5b5c69 (patch) | |
tree | 747e17b148f47a55c6ded509daf4405c3e6286ab | |
parent | 19dbb181633741563c511cf84ab2439b4e381d47 (diff) | |
download | FreeBSD-src-c28db57abb39d3a184fc1946ad3108a57c5b5c69.zip FreeBSD-src-c28db57abb39d3a184fc1946ad3108a57c5b5c69.tar.gz |
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
-rw-r--r-- | sys/netinet/cc.h | 1 | ||||
-rw-r--r-- | sys/netinet/cc/cc.c | 6 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 2 |
3 files changed, 4 insertions, 5 deletions
diff --git a/sys/netinet/cc.h b/sys/netinet/cc.h index 6f24f11..0d1dab7 100644 --- a/sys/netinet/cc.h +++ b/sys/netinet/cc.h @@ -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); diff --git a/sys/netinet/cc/cc.c b/sys/netinet/cc/cc.c index 4643ca4..de83aaf 100644 --- a/sys/netinet/cc/cc.c +++ b/sys/netinet/cc/cc.c @@ -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, void *data) 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"); diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index e6e7ca4..e863afa 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -278,8 +278,6 @@ tcp_init(void) { int hashsize; - cc_init(); - hashsize = TCBHASHSIZE; TUNABLE_INT_FETCH("net.inet.tcp.tcbhashsize", &hashsize); if (!powerof2(hashsize)) { |