Commit 16a41634 authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

bonding: switch bond_net_exit() to batch mode

cleanup_net() is competing with other rtnl users.

Batching bond_net_exit() factorizes all rtnl acquistions
to a single one, giving chance for cleanup_net()
to progress much faster, holding rtnl a bit longer.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: Jay Vosburgh <j.vosburgh@gmail.com>
Cc: Veaceslav Falico <vfalico@gmail.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent ef0de669
...@@ -6048,27 +6048,38 @@ static int __net_init bond_net_init(struct net *net) ...@@ -6048,27 +6048,38 @@ static int __net_init bond_net_init(struct net *net)
return 0; return 0;
} }
static void __net_exit bond_net_exit(struct net *net) static void __net_exit bond_net_exit_batch(struct list_head *net_list)
{ {
struct bond_net *bn = net_generic(net, bond_net_id); struct bond_net *bn;
struct bonding *bond, *tmp_bond; struct net *net;
LIST_HEAD(list); LIST_HEAD(list);
bond_destroy_sysfs(bn); list_for_each_entry(net, net_list, exit_list) {
bn = net_generic(net, bond_net_id);
bond_destroy_sysfs(bn);
}
/* Kill off any bonds created after unregistering bond rtnl ops */ /* Kill off any bonds created after unregistering bond rtnl ops */
rtnl_lock(); rtnl_lock();
list_for_each_entry_safe(bond, tmp_bond, &bn->dev_list, bond_list) list_for_each_entry(net, net_list, exit_list) {
unregister_netdevice_queue(bond->dev, &list); struct bonding *bond, *tmp_bond;
bn = net_generic(net, bond_net_id);
list_for_each_entry_safe(bond, tmp_bond, &bn->dev_list, bond_list)
unregister_netdevice_queue(bond->dev, &list);
}
unregister_netdevice_many(&list); unregister_netdevice_many(&list);
rtnl_unlock(); rtnl_unlock();
bond_destroy_proc_dir(bn); list_for_each_entry(net, net_list, exit_list) {
bn = net_generic(net, bond_net_id);
bond_destroy_proc_dir(bn);
}
} }
static struct pernet_operations bond_net_ops = { static struct pernet_operations bond_net_ops = {
.init = bond_net_init, .init = bond_net_init,
.exit = bond_net_exit, .exit_batch = bond_net_exit_batch,
.id = &bond_net_id, .id = &bond_net_id,
.size = sizeof(struct bond_net), .size = sizeof(struct bond_net),
}; };
......
...@@ -307,7 +307,6 @@ void __net_init bond_create_proc_dir(struct bond_net *bn) ...@@ -307,7 +307,6 @@ void __net_init bond_create_proc_dir(struct bond_net *bn)
} }
/* Destroy the bonding directory under /proc/net, if empty. /* Destroy the bonding directory under /proc/net, if empty.
* Caller must hold rtnl_lock.
*/ */
void __net_exit bond_destroy_proc_dir(struct bond_net *bn) void __net_exit bond_destroy_proc_dir(struct bond_net *bn)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment