Commit baf72033 authored by Kuniyuki Iwashima's avatar Kuniyuki Iwashima Committed by Jakub Kicinski
Browse files

bonding: Convert bond_net_exit_batch_rtnl() to ->exit_rtnl().



bond_net_exit_batch_rtnl() iterates the dying netns list and
performs the same operation for each.

Let's use ->exit_rtnl().

Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
Reviewed-by: default avatarSabrina Dubroca <sd@queasysnail.net>
Link: https://patch.msgid.link/20250411205258.63164-11-kuniyu@amazon.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent b7924f50
Loading
Loading
Loading
Loading
+9 −14
Original line number Diff line number Diff line
@@ -6558,7 +6558,7 @@ static int __net_init bond_net_init(struct net *net)

/* According to commit 69b0216ac255 ("bonding: fix bonding_masters
 * race condition in bond unloading") we need to remove sysfs files
 * before we remove our devices (done later in bond_net_exit_batch_rtnl())
 * before we remove our devices (done later in bond_net_exit_rtnl())
 */
static void __net_exit bond_net_pre_exit(struct net *net)
{
@@ -6567,25 +6567,20 @@ static void __net_exit bond_net_pre_exit(struct net *net)
	bond_destroy_sysfs(bn);
}

static void __net_exit bond_net_exit_batch_rtnl(struct list_head *net_list,
static void __net_exit bond_net_exit_rtnl(struct net *net,
					  struct list_head *dev_kill_list)
{
	struct bond_net *bn;
	struct net *net;

	/* Kill off any bonds created after unregistering bond rtnl ops */
	list_for_each_entry(net, net_list, exit_list) {
	struct bond_net *bn = net_generic(net, bond_net_id);
	struct bonding *bond, *tmp_bond;

		bn = net_generic(net, bond_net_id);
	/* Kill off any bonds created after unregistering bond rtnl ops */
	list_for_each_entry_safe(bond, tmp_bond, &bn->dev_list, bond_list)
		unregister_netdevice_queue(bond->dev, dev_kill_list);
}
}

/* According to commit 23fa5c2caae0 ("bonding: destroy proc directory
 * only after all bonds are gone") bond_destroy_proc_dir() is called
 * after bond_net_exit_batch_rtnl() has completed.
 * after bond_net_exit_rtnl() has completed.
 */
static void __net_exit bond_net_exit_batch(struct list_head *net_list)
{
@@ -6601,7 +6596,7 @@ static void __net_exit bond_net_exit_batch(struct list_head *net_list)
static struct pernet_operations bond_net_ops = {
	.init = bond_net_init,
	.pre_exit = bond_net_pre_exit,
	.exit_batch_rtnl = bond_net_exit_batch_rtnl,
	.exit_rtnl = bond_net_exit_rtnl,
	.exit_batch = bond_net_exit_batch,
	.id   = &bond_net_id,
	.size = sizeof(struct bond_net),