aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2009-11-29 17:25:30 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-01 19:15:52 -0500
commite008b5fc8dc7f46d9904001c7a2155eb1e7d35ab (patch)
tree17a76e3c58211ad8e8e088058701bc913f7ffd1e /net
parent999b6d39abb4fc446f3465ca4e0a7ac747f49aec (diff)
net: Simplfy default_device_exit and improve batching.
- Defer dellink to net_cleanup() allowing for batching. - Fix comment. - Use for_each_netdev_safe again as dev_change_net_namespace touches at most one network device (unlike veth dellink). Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index bb37ee1e0901..e3e18dee0bd3 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5736,14 +5736,13 @@ static struct pernet_operations __net_initdata netdev_net_ops = {
5736 5736
5737static void __net_exit default_device_exit(struct net *net) 5737static void __net_exit default_device_exit(struct net *net)
5738{ 5738{
5739 struct net_device *dev; 5739 struct net_device *dev, *aux;
5740 /* 5740 /*
5741 * Push all migratable of the network devices back to the 5741 * Push all migratable network devices back to the
5742 * initial network namespace 5742 * initial network namespace
5743 */ 5743 */
5744 rtnl_lock(); 5744 rtnl_lock();
5745restart: 5745 for_each_netdev_safe(net, dev, aux) {
5746 for_each_netdev(net, dev) {
5747 int err; 5746 int err;
5748 char fb_name[IFNAMSIZ]; 5747 char fb_name[IFNAMSIZ];
5749 5748
@@ -5751,11 +5750,9 @@ restart:
5751 if (dev->features & NETIF_F_NETNS_LOCAL) 5750 if (dev->features & NETIF_F_NETNS_LOCAL)
5752 continue; 5751 continue;
5753 5752
5754 /* Delete virtual devices */ 5753 /* Leave virtual devices for the generic cleanup */
5755 if (dev->rtnl_link_ops && dev->rtnl_link_ops->dellink) { 5754 if (dev->rtnl_link_ops)
5756 dev->rtnl_link_ops->dellink(dev, NULL); 5755 continue;
5757 goto restart;
5758 }
5759 5756
5760 /* Push remaing network devices to init_net */ 5757 /* Push remaing network devices to init_net */
5761 snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); 5758 snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex);
@@ -5765,7 +5762,6 @@ restart:
5765 __func__, dev->name, err); 5762 __func__, dev->name, err);
5766 BUG(); 5763 BUG();
5767 } 5764 }
5768 goto restart;
5769 } 5765 }
5770 rtnl_unlock(); 5766 rtnl_unlock();
5771} 5767}