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
This commit is contained in:
parent
17a6d97402
commit
14f57a8b02
@ -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);
|
||||
|
||||
|
@ -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");
|
||||
|
@ -278,8 +278,6 @@ tcp_init(void)
|
||||
{
|
||||
int hashsize;
|
||||
|
||||
cc_init();
|
||||
|
||||
hashsize = TCBHASHSIZE;
|
||||
TUNABLE_INT_FETCH("net.inet.tcp.tcbhashsize", &hashsize);
|
||||
if (!powerof2(hashsize)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user