From: Gustavo Luiz Duarte <gustavold@gmail.com>
To: "Breno Leitao" <leitao@debian.org>,
"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>,
"Matt Mackall" <mpm@selenic.com>,
"Bruno Prémont" <bonbons@linux-vserver.org>,
"Stephen Hemminger" <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Gustavo Luiz Duarte <gustavold@gmail.com>
Subject: [PATCH net-next 4/4] netconsole: remove unnecessary target refcounting from the netdev notifier
Date: Mon, 28 Sep 2026 19:00:06 +0100 [thread overview]
Message-ID: <20260928-netcons-fixes-v1-4-bb5ffe5e698a@gmail.com> (raw)
In-Reply-To: <20260928-netcons-fixes-v1-0-bb5ffe5e698a@gmail.com>
Since netconsole_netdev_event() holds target_list_lock, there is no need
to also protect each target with netconsole_target_get/put()
refcounting. There is no way a target reachable from the target_list
would go away while we hold target_list_lock.
This is similar to commit a6d403ac9689 ("netconsole: remove unnecessary
netconsole_target_get/out() from write_msg()").
Since this is the only remaining user of netconsole_target_get/put(),
remove those helpers as well.
Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>
---
drivers/net/netconsole.c | 31 -------------------------------
1 file changed, 31 deletions(-)
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 627475f16383..6c938e37b2f3 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -262,23 +262,6 @@ static void __exit dynamic_netconsole_exit(void)
configfs_unregister_subsystem(&netconsole_subsys);
}
-/*
- * Targets that were created by parsing the boot/module option string
- * do not exist in the configfs hierarchy (and have NULL names) and will
- * never go away, so make these a no-op for them.
- */
-static void netconsole_target_get(struct netconsole_target *nt)
-{
- if (config_item_name(&nt->group.cg_item))
- config_group_get(&nt->group);
-}
-
-static void netconsole_target_put(struct netconsole_target *nt)
-{
- if (config_item_name(&nt->group.cg_item))
- config_group_put(&nt->group);
-}
-
static void dynamic_netconsole_mutex_lock(void)
{
mutex_lock(&dynamic_netconsole_mutex);
@@ -300,18 +283,6 @@ static void __exit dynamic_netconsole_exit(void)
{
}
-/*
- * No danger of targets going away from under us when dynamic
- * reconfigurability is off.
- */
-static void netconsole_target_get(struct netconsole_target *nt)
-{
-}
-
-static void netconsole_target_put(struct netconsole_target *nt)
-{
-}
-
static void populate_configfs_item(struct netconsole_target *nt,
int cmdline_count)
{
@@ -1982,7 +1953,6 @@ static int netconsole_netdev_event(struct notifier_block *this,
mutex_lock(&target_cleanup_list_lock);
spin_lock_irqsave(&target_list_lock, flags);
list_for_each_entry_safe(nt, tmp, &target_list, list) {
- netconsole_target_get(nt);
if (nt->np.dev == dev) {
switch (event) {
case NETDEV_CHANGENAME:
@@ -2012,7 +1982,6 @@ static int netconsole_netdev_event(struct notifier_block *this,
* notifier.
*/
queue_work(netconsole_wq, &nt->resume_wq);
- netconsole_target_put(nt);
}
spin_unlock_irqrestore(&target_list_lock, flags);
mutex_unlock(&target_cleanup_list_lock);
--
2.55.0
prev parent reply other threads:[~2026-09-28 18:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 18:00 [PATCH net-next 0/4] netconsole: fix target enable race and configfs read locking Gustavo Luiz Duarte
2026-09-28 18:00 ` [PATCH net-next 1/4] netconsole: finish enabling the target before releasing RTNL Gustavo Luiz Duarte
2026-09-28 18:00 ` [PATCH net-next 2/4] netconsole: read np.dev under the RTNL in local_mac_show() Gustavo Luiz Duarte
2026-09-28 18:00 ` [PATCH net-next 3/4] netconsole: avoid printing partially updated target attributes Gustavo Luiz Duarte
2026-09-28 18:00 ` Gustavo Luiz Duarte [this message]
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=20260928-netcons-fixes-v1-4-bb5ffe5e698a@gmail.com \
--to=gustavold@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=bonbons@linux-vserver.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stephen@networkplumber.org \
/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
all inboxes | Powered by JetHome®