diff options
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index e3e18dee0bd3..0913a08a87d6 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -5766,8 +5766,33 @@ static void __net_exit default_device_exit(struct net *net) | |||
5766 | rtnl_unlock(); | 5766 | rtnl_unlock(); |
5767 | } | 5767 | } |
5768 | 5768 | ||
5769 | static void __net_exit default_device_exit_batch(struct list_head *net_list) | ||
5770 | { | ||
5771 | /* At exit all network devices most be removed from a network | ||
5772 | * namespace. Do this in the reverse order of registeration. | ||
5773 | * Do this across as many network namespaces as possible to | ||
5774 | * improve batching efficiency. | ||
5775 | */ | ||
5776 | struct net_device *dev; | ||
5777 | struct net *net; | ||
5778 | LIST_HEAD(dev_kill_list); | ||
5779 | |||
5780 | rtnl_lock(); | ||
5781 | list_for_each_entry(net, net_list, exit_list) { | ||
5782 | for_each_netdev_reverse(net, dev) { | ||
5783 | if (dev->rtnl_link_ops) | ||
5784 | dev->rtnl_link_ops->dellink(dev, &dev_kill_list); | ||
5785 | else | ||
5786 | unregister_netdevice_queue(dev, &dev_kill_list); | ||
5787 | } | ||
5788 | } | ||
5789 | unregister_netdevice_many(&dev_kill_list); | ||
5790 | rtnl_unlock(); | ||
5791 | } | ||
5792 | |||
5769 | static struct pernet_operations __net_initdata default_device_ops = { | 5793 | static struct pernet_operations __net_initdata default_device_ops = { |
5770 | .exit = default_device_exit, | 5794 | .exit = default_device_exit, |
5795 | .exit_batch = default_device_exit_batch, | ||
5771 | }; | 5796 | }; |
5772 | 5797 | ||
5773 | /* | 5798 | /* |