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@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Gustavo Luiz Duarte <gustavold@gmail.com>
Subject: [PATCH net-next 2/2] netconsole: remove unnecessary target refcounting from the netdev notifier
Date: Tue, 06 Oct 2026 19:58:30 +0100 [thread overview]
Message-ID: <20261006-netcons-fixes-next-v1-2-231cd26f8c51@gmail.com> (raw)
In-Reply-To: <20261006-netcons-fixes-next-v1-0-231cd26f8c51@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 188beacb308d..ddc5fcf19fe6 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)
{
@@ -1979,7 +1950,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:
@@ -2009,7 +1979,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
next prev parent reply other threads:[~2026-10-06 18:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 18:58 [PATCH net-next 0/2] netconsole: add locking to configfs _show callbacks Gustavo Luiz Duarte
2026-10-06 18:58 ` [PATCH net-next 1/2] netconsole: avoid printing partially updated target attributes Gustavo Luiz Duarte
2026-10-06 20:35 ` Eric Dumazet
2026-10-06 18:58 ` Gustavo Luiz Duarte [this message]
2026-10-06 19:06 ` [PATCH net-next 0/2] netconsole: add locking to configfs _show callbacks netdev-bot+sinfo
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=20261006-netcons-fixes-next-v1-2-231cd26f8c51@gmail.com \
--to=gustavold@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®