Skip to content

Commit a1fab9a

Browse files
edumazetkuba-moo
authored andcommitted
ip6_tunnel: use exit_batch_rtnl() method
exit_batch_rtnl() is called while RTNL is held, and devices to be unregistered can be queued in the dev_kill_list. This saves one rtnl_lock()/rtnl_unlock() pair and one unregister_netdevice_many() call. Signed-off-by: Eric Dumazet <[email protected]> Reviewed-by: Antoine Tenart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent bc50c53 commit a1fab9a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

net/ipv6/ip6_tunnel.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2282,21 +2282,19 @@ static int __net_init ip6_tnl_init_net(struct net *net)
22822282
return err;
22832283
}
22842284

2285-
static void __net_exit ip6_tnl_exit_batch_net(struct list_head *net_list)
2285+
static void __net_exit ip6_tnl_exit_batch_rtnl(struct list_head *net_list,
2286+
struct list_head *dev_to_kill)
22862287
{
22872288
struct net *net;
2288-
LIST_HEAD(list);
22892289

2290-
rtnl_lock();
2290+
ASSERT_RTNL();
22912291
list_for_each_entry(net, net_list, exit_list)
2292-
ip6_tnl_destroy_tunnels(net, &list);
2293-
unregister_netdevice_many(&list);
2294-
rtnl_unlock();
2292+
ip6_tnl_destroy_tunnels(net, dev_to_kill);
22952293
}
22962294

22972295
static struct pernet_operations ip6_tnl_net_ops = {
22982296
.init = ip6_tnl_init_net,
2299-
.exit_batch = ip6_tnl_exit_batch_net,
2297+
.exit_batch_rtnl = ip6_tnl_exit_batch_rtnl,
23002298
.id = &ip6_tnl_net_id,
23012299
.size = sizeof(struct ip6_tnl_net),
23022300
};

0 commit comments

Comments
 (0)