Commit 91e2ff35 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by David S. Miller

net: Teach vlans to cleanup as a pernet subsystem

Take advantage of the fact that an explicit rtnl_kill_links is
unnecessary (and skipping it improves batching), as network namespace
exit calls dellink on all remaining virtual devices, and
rtnl_link_unregister calls dellink on all outstanding devices in that
network namespace.  To do this we need to leave the vlan proc
directories in place until after network device exit time, which is
done by using register_pernet_subsys instead of
register_pernet_device.
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 650de8de
...@@ -698,8 +698,6 @@ static int vlan_init_net(struct net *net) ...@@ -698,8 +698,6 @@ static int vlan_init_net(struct net *net)
static void vlan_exit_net(struct net *net) static void vlan_exit_net(struct net *net)
{ {
rtnl_kill_links(net, &vlan_link_ops);
vlan_proc_cleanup(net); vlan_proc_cleanup(net);
} }
...@@ -717,7 +715,7 @@ static int __init vlan_proto_init(void) ...@@ -717,7 +715,7 @@ static int __init vlan_proto_init(void)
pr_info("%s v%s %s\n", vlan_fullname, vlan_version, vlan_copyright); pr_info("%s v%s %s\n", vlan_fullname, vlan_version, vlan_copyright);
pr_info("All bugs added by %s\n", vlan_buggyright); pr_info("All bugs added by %s\n", vlan_buggyright);
err = register_pernet_device(&vlan_net_ops); err = register_pernet_subsys(&vlan_net_ops);
if (err < 0) if (err < 0)
goto err0; goto err0;
...@@ -742,7 +740,7 @@ static int __init vlan_proto_init(void) ...@@ -742,7 +740,7 @@ static int __init vlan_proto_init(void)
err3: err3:
unregister_netdevice_notifier(&vlan_notifier_block); unregister_netdevice_notifier(&vlan_notifier_block);
err2: err2:
unregister_pernet_device(&vlan_net_ops); unregister_pernet_subsys(&vlan_net_ops);
err0: err0:
return err; return err;
} }
...@@ -762,7 +760,7 @@ static void __exit vlan_cleanup_module(void) ...@@ -762,7 +760,7 @@ static void __exit vlan_cleanup_module(void)
for (i = 0; i < VLAN_GRP_HASH_SIZE; i++) for (i = 0; i < VLAN_GRP_HASH_SIZE; i++)
BUG_ON(!hlist_empty(&vlan_group_hash[i])); BUG_ON(!hlist_empty(&vlan_group_hash[i]));
unregister_pernet_device(&vlan_net_ops); unregister_pernet_subsys(&vlan_net_ops);
rcu_barrier(); /* Wait for completion of call_rcu()'s */ rcu_barrier(); /* Wait for completion of call_rcu()'s */
vlan_gvrp_uninit(); vlan_gvrp_uninit();
......
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