Netdev List
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: "David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	 Andrew Lunn <andrew+netdev@lunn.ch>
Cc: netdev@vger.kernel.org, asantostc@gmail.com, gustavold@gmail.com,
	 linux-kernel@vger.kernel.org, Breno Leitao <leitao@debian.org>,
	 kernel-team@meta.com
Subject: [PATCH net-next v3 1/9] netconsole: clean up released targets dropped before the cleanup worker
Date: Fri, 10 Jul 2026 04:38:53 -0700	[thread overview]
Message-ID: <20260710-netconsole_move_more-v3-1-6f63f76b28bc@debian.org> (raw)
In-Reply-To: <20260710-netconsole_move_more-v3-0-6f63f76b28bc@debian.org>

drop_netconsole_target() might eventually tear down a target that
netconsole_netdev_event() had moved to target_cleanup_list but that
netconsole_process_cleanups_core() had not processed yet.

Always cleanup devices that eventually have a device attached to the
target, independent of the state.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/netconsole.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index c1812a98365b7..a939daa07cf9d 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -1481,15 +1481,15 @@ static void drop_netconsole_target(struct config_group *group,
 
 	mutex_lock(&target_cleanup_list_lock);
 	spin_lock_irqsave(&target_list_lock, flags);
-	/* A STATE_DEACTIVATED target may have been moved to
-	 * target_cleanup_list by netconsole_netdev_event() but not yet
-	 * processed by netconsole_process_cleanups_core(). Unlinking it below
-	 * hides it from the cleanup worker, so this path has to clean it up
-	 * itself. Record that the target still owns a netpoll before the
-	 * state is downgraded.
+	/* A target moved to target_cleanup_list by netconsole_netdev_event()
+	 * but not yet processed still owns a netpoll; unlinking it below hides
+	 * it from the cleanup worker, so this path must tear it down itself.
+	 * This covers NETDEV_UNREGISTER (STATE_DEACTIVATED) and
+	 * NETDEV_RELEASE / NETDEV_JOIN (STATE_DISABLED); key off nt->np.dev,
+	 * which stays set until the netpoll is cleaned up.
 	 */
 	needs_cleanup = nt->state == STATE_ENABLED ||
-			nt->state == STATE_DEACTIVATED;
+			nt->state == STATE_DEACTIVATED || nt->np.dev;
 	/* Disable deactivated target to prevent races between resume attempt
 	 * and target removal.
 	 */

-- 
2.53.0-Meta


  reply	other threads:[~2026-07-10 11:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 11:38 [PATCH net-next v3 0/9] netconsole: stop charging netpoll users for netconsole-only data Breno Leitao
2026-07-10 11:38 ` Breno Leitao [this message]
2026-07-10 11:38 ` [PATCH net-next v3 2/9] netpoll: export refill_skbs(), refill_skbs_work_handler(), skb_pool_flush() Breno Leitao
2026-07-10 11:38 ` [PATCH net-next v3 3/9] netconsole: take over skb pool lifecycle from netpoll Breno Leitao
2026-07-10 11:38 ` [PATCH net-next v3 4/9] netconsole: move refill_skbs_work_handler() " Breno Leitao
2026-07-10 11:38 ` [PATCH net-next v3 5/9] netconsole: move refill_skbs() and skb-pool sizing macros " Breno Leitao
2026-07-10 11:38 ` [PATCH net-next v3 6/9] netconsole: move skb_pool_flush() " Breno Leitao
2026-07-10 11:38 ` [PATCH net-next v3 7/9] netconsole: move skb_pool / refill_wq from struct netpoll to netconsole_target Breno Leitao
2026-07-10 11:39 ` [PATCH net-next v3 8/9] netconsole: move local_port / remote_port " Breno Leitao
2026-07-10 11:39 ` [PATCH net-next v3 9/9] netconsole: move remote_mac " Breno Leitao

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=20260710-netconsole_move_more-v3-1-6f63f76b28bc@debian.org \
    --to=leitao@debian.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=asantostc@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gustavold@gmail.com \
    --cc=horms@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.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