diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2009-11-29 22:25:30 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-12-02 00:15:52 (GMT) |
commit | e008b5fc8dc7f46d9904001c7a2155eb1e7d35ab (patch) | |
tree | 17a76e3c58211ad8e8e088058701bc913f7ffd1e /net/core | |
parent | 999b6d39abb4fc446f3465ca4e0a7ac747f49aec (diff) | |
download | linux-e008b5fc8dc7f46d9904001c7a2155eb1e7d35ab.tar.xz |
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/core')
-rw-r--r-- | net/core/dev.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index bb37ee1..e3e18de 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5736,14 +5736,13 @@ static struct pernet_operations __net_initdata netdev_net_ops = { static void __net_exit default_device_exit(struct net *net) { - struct net_device *dev; + struct net_device *dev, *aux; /* - * Push all migratable of the network devices back to the + * Push all migratable network devices back to the * initial network namespace */ rtnl_lock(); -restart: - for_each_netdev(net, dev) { + for_each_netdev_safe(net, dev, aux) { int err; char fb_name[IFNAMSIZ]; @@ -5751,11 +5750,9 @@ restart: if (dev->features & NETIF_F_NETNS_LOCAL) continue; - /* Delete virtual devices */ - if (dev->rtnl_link_ops && dev->rtnl_link_ops->dellink) { - dev->rtnl_link_ops->dellink(dev, NULL); - goto restart; - } + /* Leave virtual devices for the generic cleanup */ + if (dev->rtnl_link_ops) + continue; /* Push remaing network devices to init_net */ snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); @@ -5765,7 +5762,6 @@ restart: __func__, dev->name, err); BUG(); } - goto restart; } rtnl_unlock(); } |