Skip to content

Commit de02dea

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

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

net/ipv6/sit.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,22 +1875,19 @@ static int __net_init sit_init_net(struct net *net)
18751875
return err;
18761876
}
18771877

1878-
static void __net_exit sit_exit_batch_net(struct list_head *net_list)
1878+
static void __net_exit sit_exit_batch_rtnl(struct list_head *net_list,
1879+
struct list_head *dev_to_kill)
18791880
{
1880-
LIST_HEAD(list);
18811881
struct net *net;
18821882

1883-
rtnl_lock();
1883+
ASSERT_RTNL();
18841884
list_for_each_entry(net, net_list, exit_list)
1885-
sit_destroy_tunnels(net, &list);
1886-
1887-
unregister_netdevice_many(&list);
1888-
rtnl_unlock();
1885+
sit_destroy_tunnels(net, dev_to_kill);
18891886
}
18901887

18911888
static struct pernet_operations sit_net_ops = {
18921889
.init = sit_init_net,
1893-
.exit_batch = sit_exit_batch_net,
1890+
.exit_batch_rtnl = sit_exit_batch_rtnl,
18941891
.id = &sit_net_id,
18951892
.size = sizeof(struct sit_net),
18961893
};

0 commit comments

Comments
 (0)