Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: achender@kernel.org
Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	pabeni@redhat.com, edumazet@google.com, kuba@kernel.org,
	horms@kernel.org
Subject: Re: [PATCH net-next v8 08/13] net/rds: wait for connections to be freed on transport unload
Date: Sun, 04 Oct 2026 16:35:01 +0000	[thread overview]
Message-ID: <179113170151.434549.12580197013439113648@kernel.org> (raw)
In-Reply-To: <20261003163215.250253-9-achender@kernel.org>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] This patch fixes two real, pre-existing unload bugs in the IB
  transport, but carries no Fixes: tag.

--

net/rds: wait for connections to be freed on transport unload

This patch adds a per-transport t_conn_count of live connections. The IB,
TCP and loop exit paths now wait for that count to reach zero before
unloading. For IB, the wait also calls rds_ib_destroy_nodev_conns() on
every poll, and rds_ib_exit() flushes rds_wq again once the connections
are gone.

> diff --git a/net/rds/ib.c b/net/rds/ib.c
> index d9879b6129e73..7b1f611c0a3e5 100644
> --- a/net/rds/ib.c
> +++ b/net/rds/ib.c
> @@ -540,7 +540,24 @@ void rds_ib_exit(void)
>  	rds_info_deregister_func(RDS6_INFO_IB_CONNECTIONS, rds6_ib_ic_info);
>  #endif
>  	rds_ib_unregister_client();
> +
> +	/* rds_ib_dev_shutdown() only dropped the connections still
> +	 * attached to a device; each moves itself to ib_nodev_conns
> +	 * from its shutdown work.  Destroy what is there now and keep
> +	 * sweeping the list while the wait sees connections outstanding,
> +	 * so a late arrival is destroyed rather than waited on forever.
> +	 */
>  	rds_ib_destroy_nodev_conns();
> +	rds_conn_wait_conns_freed(&rds_ib_transport,
> +				  rds_ib_destroy_nodev_conns);
> +
> +	/* Tearing down the last connection may have dropped the final
> +	 * reference on a device, deferring rds_ib_dev_free() to rds_wq.
> +	 * Drain it before the module goes away; it queues nothing
> +	 * further on rds_wq.
> +	 */
> +	flush_workqueue(rds_wq);
> +

[Severity: Low]

The resweep and the second flush_workqueue(rds_wq) seem to fix two IB
unload bugs that already exist in the tree before this patch. Should this
patch have a Fixes: tag?

The first bug starts in rds_ib_dev_shutdown(), which queues cp_down_w on
the per-path cp_wq:

	list_for_each_entry(ic, &rds_ibdev->conn_list, ib_node)
		rds_conn_path_drop(&ic->conn->c_path[0], true);

Since commit 4716af3897e9 ("net/rds: Give each connection path its own
workqueue"), cp_wq is a private ordered workqueue instead of rds_wq. So
the flush_workqueue(rds_wq) in rds_ib_unregister_client() does not wait
for those shutdown works.

If rds_ib_remove_conn() moves a connection to ib_nodev_conns after the
single rds_ib_destroy_nodev_conns() sweep, nothing destroys it. It
outlives the module and still points at rds_ib_transport.

The second bug follows from that. rds_ib_remove_conn() then calls
rds_ib_dev_put(), which does this when it drops the last device
reference:

	if (refcount_dec_and_test(&rds_ibdev->refcount))
		queue_work(rds_wq, &rds_ibdev->free_work);

That queues rds_ib_dev_free() after the only flush of rds_wq. It could
then run after the module text is gone.

The commit message already calls the first bug "an existing hole". Of
the second it says "nothing flushed rds_wq again after
rds_ib_unregister_client() before". Other fixes in this series carry a
Fixes: tag. Would a Fixes: 4716af3897e9 tag fit here as well?

The opening paragraph of the commit message also says:

  At this point in the series the initial reference is the only one
  and the wait returns at once; the guarantee becomes load-bearing
  with those patches.

Is that accurate for IB? A connection that reaches ib_nodev_conns late
keeps t_conn_count above zero. The loop in rds_conn_wait_conns_freed()
then has to call the resweep to destroy it, so the patch already changes
behavior at this point in the series.

Could the opening paragraph be reworded so backport readers don't take
the patch as a no-op?

It may also be worth splitting out a small standalone fix that doesn't
depend on the kref/t_conn_count infrastructure. One option is to flush
the per-connection shutdown works, or loop until the device lists and
ib_nodev_conns are empty, and then flush rds_wq.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261003163215.250253-1-achender%40kernel.org

  reply	other threads:[~2026-10-04 16:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-03 16:32 [PATCH net-next v8 00/13] net/rds: make connection lifetime reference-counted Allison Henderson
2026-10-03 16:32 ` [PATCH net-next v8 01/13] net/rds: ib: don't enable interrupts in rds_ib_conn_free() Allison Henderson
2026-10-03 16:32 ` [PATCH net-next v8 02/13] net/rds: undo conn_alloc() the same way on every __rds_conn_create() exit Allison Henderson
2026-10-03 16:32 ` [PATCH net-next v8 03/13] net/rds: ib: refuse to attach a connection to a device being removed Allison Henderson
2026-10-04 16:34   ` netdev-bot+sashiko
2026-10-03 16:32 ` [PATCH net-next v8 04/13] net/rds: guard every work-requeueing site with rds_destroy_pending() Allison Henderson
2026-10-04 16:34   ` netdev-bot+sashiko
2026-10-03 16:32 ` [PATCH net-next v8 05/13] net/rds: make rds_destroy_pending() report a connection's own destroy Allison Henderson
2026-10-03 16:32 ` [PATCH net-next v8 06/13] net/rds: split connection destroy into quiesce and kref-governed free Allison Henderson
2026-10-03 16:32 ` [PATCH net-next v8 07/13] net/rds: unlink transport nodes before a possibly deferred connection free Allison Henderson
2026-10-04 16:35   ` netdev-bot+sashiko
2026-10-03 16:32 ` [PATCH net-next v8 08/13] net/rds: wait for connections to be freed on transport unload Allison Henderson
2026-10-04 16:35   ` netdev-bot+sashiko [this message]
2026-10-03 16:32 ` [PATCH net-next v8 09/13] net/rds: hold a connection reference from struct rds_incoming Allison Henderson
2026-10-04 16:35   ` netdev-bot+sashiko
2026-10-03 16:32 ` [PATCH net-next v8 10/13] net/rds: take cp_lock to purge cp_send_queue in the quiesce Allison Henderson
2026-10-03 16:32 ` [PATCH net-next v8 11/13] net/rds: hold connection references in lookup, sockets and c_passive Allison Henderson
2026-10-04 16:35   ` netdev-bot+sashiko
2026-10-03 16:32 ` [PATCH net-next v8 12/13] net/rds: pin the connection across RDMA-CM event handling Allison Henderson
2026-10-04 16:35   ` netdev-bot+sashiko
2026-10-03 16:32 ` [PATCH net-next v8 13/13] net/rds: drop rds_conn_count in favor of t_conn_count Allison Henderson

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=179113170151.434549.12580197013439113648@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=achender@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-rdma@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