Skip to content

Commit 806b678

Browse files
edumazetkuba-moo
authored andcommitted
bridge: 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 per netns 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 9b5b363 commit 806b678

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

net/bridge/br.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -356,26 +356,21 @@ void br_opt_toggle(struct net_bridge *br, enum net_bridge_opts opt, bool on)
356356
clear_bit(opt, &br->options);
357357
}
358358

359-
static void __net_exit br_net_exit_batch(struct list_head *net_list)
359+
static void __net_exit br_net_exit_batch_rtnl(struct list_head *net_list,
360+
struct list_head *dev_to_kill)
360361
{
361362
struct net_device *dev;
362363
struct net *net;
363-
LIST_HEAD(list);
364-
365-
rtnl_lock();
366364

365+
ASSERT_RTNL();
367366
list_for_each_entry(net, net_list, exit_list)
368367
for_each_netdev(net, dev)
369368
if (netif_is_bridge_master(dev))
370-
br_dev_delete(dev, &list);
371-
372-
unregister_netdevice_many(&list);
373-
374-
rtnl_unlock();
369+
br_dev_delete(dev, dev_to_kill);
375370
}
376371

377372
static struct pernet_operations br_net_ops = {
378-
.exit_batch = br_net_exit_batch,
373+
.exit_batch_rtnl = br_net_exit_batch_rtnl,
379374
};
380375

381376
static const struct stp_proto br_stp_proto = {

0 commit comments

Comments
 (0)