Skip to content

Commit 7a99f3c

Browse files
edumazetkuba-moo
authored andcommitted
ip6_vti: 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 a1fab9a commit 7a99f3c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

net/ipv6/ip6_vti.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,24 +1174,22 @@ static int __net_init vti6_init_net(struct net *net)
11741174
return err;
11751175
}
11761176

1177-
static void __net_exit vti6_exit_batch_net(struct list_head *net_list)
1177+
static void __net_exit vti6_exit_batch_rtnl(struct list_head *net_list,
1178+
struct list_head *dev_to_kill)
11781179
{
11791180
struct vti6_net *ip6n;
11801181
struct net *net;
1181-
LIST_HEAD(list);
11821182

1183-
rtnl_lock();
1183+
ASSERT_RTNL();
11841184
list_for_each_entry(net, net_list, exit_list) {
11851185
ip6n = net_generic(net, vti6_net_id);
1186-
vti6_destroy_tunnels(ip6n, &list);
1186+
vti6_destroy_tunnels(ip6n, dev_to_kill);
11871187
}
1188-
unregister_netdevice_many(&list);
1189-
rtnl_unlock();
11901188
}
11911189

11921190
static struct pernet_operations vti6_net_ops = {
11931191
.init = vti6_init_net,
1194-
.exit_batch = vti6_exit_batch_net,
1192+
.exit_batch_rtnl = vti6_exit_batch_rtnl,
11951193
.id = &vti6_net_id,
11961194
.size = sizeof(struct vti6_net),
11971195
};

0 commit comments

Comments
 (0)