netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
	Kuniyuki Iwashima <kuniyu@amazon.com>,
	Kuniyuki Iwashima <kuni1840@gmail.com>, <netdev@vger.kernel.org>,
	"Jay Vosburgh" <jv@jvosburgh.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>
Subject: [PATCH v1 net-next 10/14] bonding: Convert bond_net_exit_batch_rtnl() to ->exit_rtnl().
Date: Wed, 9 Apr 2025 19:19:31 -0700	[thread overview]
Message-ID: <20250410022004.8668-11-kuniyu@amazon.com> (raw)
In-Reply-To: <20250410022004.8668-1-kuniyu@amazon.com>

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: Kuniyuki Iwashima <kuniyu@amazon.com>
---
Cc: Jay Vosburgh <jv@jvosburgh.net>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
---
 drivers/net/bonding/bond_main.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 950d8e4d86f8..bdd36409dd9b 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -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,
-						struct list_head *dev_kill_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;
+	struct bond_net *bn = net_generic(net, bond_net_id);
+	struct bonding *bond, *tmp_bond;
 
 	/* Kill off any bonds created after unregistering bond rtnl ops */
-	list_for_each_entry(net, net_list, exit_list) {
-		struct bonding *bond, *tmp_bond;
-
-		bn = net_generic(net, bond_net_id);
-		list_for_each_entry_safe(bond, tmp_bond, &bn->dev_list, bond_list)
-			unregister_netdevice_queue(bond->dev, dev_kill_list);
-	}
+	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),
-- 
2.49.0


  parent reply	other threads:[~2025-04-10  2:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-10  2:19 [PATCH v1 net-next 00/14] net: Convert ->exit_batch_rtnl() to ->exit_rtnl() Kuniyuki Iwashima
2025-04-10  2:19 ` [PATCH v1 net-next 01/14] net: Factorise setup_net() and cleanup_net() Kuniyuki Iwashima
2025-04-10  2:19 ` [PATCH v1 net-next 02/14] net: Add ops_undo_single for module load/unload Kuniyuki Iwashima
2025-04-11  3:16   ` kernel test robot
2025-04-11  3:32     ` OA[PATCH " Kuniyuki Iwashima
2025-04-11  4:37   ` [PATCH " kernel test robot
2025-04-10  2:19 ` [PATCH v1 net-next 03/14] net: Add ->exit_rtnl() hook to struct pernet_operations Kuniyuki Iwashima
2025-04-10  2:19 ` [PATCH v1 net-next 04/14] nexthop: Convert nexthop_net_exit_batch_rtnl() to ->exit_rtnl() Kuniyuki Iwashima
2025-04-10 14:34   ` David Ahern
2025-04-10  2:19 ` [PATCH v1 net-next 05/14] vxlan: Convert vxlan_exit_batch_rtnl() " Kuniyuki Iwashima
2025-04-10  9:07   ` Nikolay Aleksandrov
2025-04-10  2:19 ` [PATCH v1 net-next 06/14] ipv4: ip_tunnel: Convert ip_tunnel_delete_nets() callers " Kuniyuki Iwashima
2025-04-10 14:46   ` David Ahern
2025-04-10  2:19 ` [PATCH v1 net-next 07/14] ipv6: Convert tunnel devices' ->exit_batch_rtnl() " Kuniyuki Iwashima
2025-04-10 14:50   ` David Ahern
2025-04-10  2:19 ` [PATCH v1 net-next 08/14] xfrm: Convert xfrmi_exit_batch_rtnl() " Kuniyuki Iwashima
2025-04-10  2:19 ` [PATCH v1 net-next 09/14] bridge: Convert br_net_exit_batch_rtnl() " Kuniyuki Iwashima
2025-04-10  7:05   ` Ido Schimmel
2025-04-10  9:04   ` Nikolay Aleksandrov
2025-04-10  2:19 ` Kuniyuki Iwashima [this message]
2025-04-10  9:44   ` [PATCH v1 net-next 10/14] bonding: Convert bond_net_exit_batch_rtnl() " Nikolay Aleksandrov
2025-04-10  2:19 ` [PATCH v1 net-next 11/14] gtp: Convert gtp_net_exit_batch_rtnl() " Kuniyuki Iwashima
2025-04-10  2:19 ` [PATCH v1 net-next 12/14] bareudp: Convert bareudp_exit_batch_rtnl() " Kuniyuki Iwashima
2025-04-10  2:19 ` [PATCH v1 net-next 13/14] geneve: Convert geneve_exit_batch_rtnl() " Kuniyuki Iwashima
2025-04-10  2:19 ` [PATCH v1 net-next 14/14] net: Remove ->exit_batch_rtnl() Kuniyuki Iwashima

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250410022004.8668-11-kuniyu@amazon.com \
    --to=kuniyu@amazon.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jv@jvosburgh.net \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).