From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"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>
Subject: [PATCH v2 net-next 1/3] net: Drop hold_rtnl arg from ops_undo_list().
Date: Thu, 17 Apr 2025 17:32:32 -0700 [thread overview]
Message-ID: <20250418003259.48017-2-kuniyu@amazon.com> (raw)
In-Reply-To: <20250418003259.48017-1-kuniyu@amazon.com>
ops_undo_list() first iterates over ops_list for ->pre_exit().
Let's check if any of the ops has ->exit_rtnl() there and drop
the hold_rtnl argument.
Note that nexthop uses ->exit_rtnl() and is built-in, so hold_rtnl
is always true for setup_net() and cleanup_net() for now.
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/netdev/20250414170148.21f3523c@kernel.org/
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
net/core/net_namespace.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 0a2b24af4028..48dd6dc603c9 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -220,17 +220,20 @@ static void ops_free_list(const struct pernet_operations *ops,
static void ops_undo_list(const struct list_head *ops_list,
const struct pernet_operations *ops,
struct list_head *net_exit_list,
- bool expedite_rcu, bool hold_rtnl)
+ bool expedite_rcu)
{
const struct pernet_operations *saved_ops;
+ bool hold_rtnl = false;
if (!ops)
ops = list_entry(ops_list, typeof(*ops), list);
saved_ops = ops;
- list_for_each_entry_continue_reverse(ops, ops_list, list)
+ list_for_each_entry_continue_reverse(ops, ops_list, list) {
+ hold_rtnl |= !!ops->exit_rtnl;
ops_pre_exit_list(ops, net_exit_list);
+ }
/* Another CPU might be rcu-iterating the list, wait for it.
* This needs to be before calling the exit() notifiers, so the
@@ -257,11 +260,10 @@ static void ops_undo_list(const struct list_head *ops_list,
static void ops_undo_single(struct pernet_operations *ops,
struct list_head *net_exit_list)
{
- bool hold_rtnl = !!ops->exit_rtnl;
LIST_HEAD(ops_list);
list_add(&ops->list, &ops_list);
- ops_undo_list(&ops_list, NULL, net_exit_list, false, hold_rtnl);
+ ops_undo_list(&ops_list, NULL, net_exit_list, false);
list_del(&ops->list);
}
@@ -452,7 +454,7 @@ static __net_init int setup_net(struct net *net)
* for the pernet modules whose init functions did not fail.
*/
list_add(&net->exit_list, &net_exit_list);
- ops_undo_list(&pernet_list, ops, &net_exit_list, false, true);
+ ops_undo_list(&pernet_list, ops, &net_exit_list, false);
rcu_barrier();
goto out;
}
@@ -681,7 +683,7 @@ static void cleanup_net(struct work_struct *work)
list_add_tail(&net->exit_list, &net_exit_list);
}
- ops_undo_list(&pernet_list, NULL, &net_exit_list, true, true);
+ ops_undo_list(&pernet_list, NULL, &net_exit_list, true);
up_read(&pernet_ops_rwsem);
--
2.49.0
next prev parent reply other threads:[~2025-04-18 0:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-18 0:32 [PATCH v2 net-next 0/3] net: Followup series for ->exit_rtnl() Kuniyuki Iwashima
2025-04-18 0:32 ` Kuniyuki Iwashima [this message]
2025-04-18 0:32 ` [PATCH v2 net-next 2/3] pfcp: Convert pfcp_net_exit() to ->exit_rtnl() Kuniyuki Iwashima
2025-04-23 2:47 ` Jakub Kicinski
2025-04-23 8:37 ` Michal Swiatkowski
2025-04-23 13:33 ` Jakub Kicinski
2025-04-24 4:40 ` Michal Swiatkowski
2025-04-24 22:26 ` Jakub Kicinski
2025-04-25 4:28 ` Michal Swiatkowski
2025-04-23 13:40 ` Jakub Kicinski
2025-04-23 14:12 ` Kuniyuki Iwashima
2025-04-23 22:33 ` Jakub Kicinski
2025-04-23 22:52 ` Jakub Kicinski
2025-04-24 2:23 ` Kuniyuki Iwashima
2025-04-24 22:24 ` Jakub Kicinski
2025-04-18 0:32 ` [PATCH v2 net-next 3/3] ppp: Split ppp_exit_net() " Kuniyuki Iwashima
2025-04-23 2:50 ` [PATCH v2 net-next 0/3] net: Followup series for ->exit_rtnl() patchwork-bot+netdevbpf
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=20250418003259.48017-2-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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.