* Re: [PATCH] net/rds: drop the device reference for ODP memory regions
2026-11-04 2:28 [PATCH] net/rds: drop the device reference for ODP memory regions Wentao Liang
@ 2026-11-04 2:33 ` netdev-bot+sinfo
2026-11-04 7:11 ` Krzysztof Kozlowski
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: netdev-bot+sinfo @ 2026-11-04 2:33 UTC (permalink / raw)
To: Wentao Liang
Cc: Allison Henderson, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, netdev, linux-rdma, rds-devel
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by code inspection). If it was triggered please include
the symptoms, like the stack trace or error messages.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account. If the series needs another revision for
other reasons, please include the information in the commit messages
then.
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] net/rds: drop the device reference for ODP memory regions
2026-11-04 2:28 [PATCH] net/rds: drop the device reference for ODP memory regions Wentao Liang
2026-11-04 2:33 ` netdev-bot+sinfo
@ 2026-11-04 7:11 ` Krzysztof Kozlowski
2026-11-04 22:15 ` Allison Henderson
2026-11-08 3:04 ` netdev-bot+sashiko
3 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-04 7:11 UTC (permalink / raw)
To: Wentao Liang
Cc: David S. Miller, Simon Horman, Paolo Abeni, linux-rdma,
Eric Dumazet, Jakub Kicinski, netdev, Allison Henderson,
rds-devel
On Wed, 04 Nov 2026 02:28:10 +0000, Wentao Liang wrote:
> rds_ib_get_mr() takes a reference on the rds_ib_device with
> rds_ib_get_device(). The FRMR path stores it in ibmr->device and
> rds_ib_free_mr() drops it when the MR is freed.
>
> The ODP path allocates the ibmr with kzalloc_obj() and returns it
> without recording the device. rds_ib_odp_mr_worker() only deregisters
> the MR and frees the ibmr, so the reference taken for every ODP MR is
> never dropped and the rds_ib_device can no longer be released.
>
> Store the reference in ibmr->device and drop it in the worker after
> the MR has been deregistered, which also keeps the device and its PD
> alive for as long as the MR exists.
>
> Fixes: 2eafa1746f17 ("net/rds: Handle ODP mr registration/unregistration")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> net/rds/ib_rdma.c | 2 ++
> 1 file changed, 2 insertions(+)
>
Multiple things here:
1. Your team ignored completely previous feedback. Multiple times.
2. You use multiple identities with this email address, thus I doubt that we
speak with an actual person.
3. Your bot does not even bother running checkpatch, right?
4. Nothing of this was reproduced nor tested.
5. Finally, the same feedback:
You sent multiple independent patches, to multiple independent
subsystems. The amount of these patches clearly suggest this was
AI generated and most likely not tested.
More importantly, you sent all this work without properly organizing
relevant patches into patchsets. This makes reviewing difficult
and might cause multiple reviewers to address the same issue.
Replying to the entire set is impossible and requires handling each
patch independently, instead of applying or discarding the set.
Maintainers also won't see the bigger picture of your work. Quite
worrying.
This is on the verge of hostile patch: bomb us with so many
contributions, we won't be able to handle them in efficient manner,
like responding ONCE to ask you to slow down. Considering all this
is untested and LLM generated, I have even more doubts whether this
should be considered for review.
Please read kernel documentation BEFORE posting more work. It will
explain you how to identify subsystems, how to organize your work per
subsystem (so a patchset grouping multiple patches with a short cover
letter), how to document the issue discovery method and what was
or was not tested.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] net/rds: drop the device reference for ODP memory regions
2026-11-04 2:28 [PATCH] net/rds: drop the device reference for ODP memory regions Wentao Liang
2026-11-04 2:33 ` netdev-bot+sinfo
2026-11-04 7:11 ` Krzysztof Kozlowski
@ 2026-11-04 22:15 ` Allison Henderson
2026-11-08 3:04 ` netdev-bot+sashiko
3 siblings, 0 replies; 5+ messages in thread
From: Allison Henderson @ 2026-11-04 22:15 UTC (permalink / raw)
To: Wentao Liang, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman
Cc: netdev, linux-rdma, rds-devel
On Wed, 2026-11-04 at 02:28 +0000, Wentao Liang wrote:
> rds_ib_get_mr() takes a reference on the rds_ib_device with
> rds_ib_get_device(). The FRMR path stores it in ibmr->device and
> rds_ib_free_mr() drops it when the MR is freed.
>
> The ODP path allocates the ibmr with kzalloc_obj() and returns it
> without recording the device. rds_ib_odp_mr_worker() only deregisters
> the MR and frees the ibmr, so the reference taken for every ODP MR is
> never dropped and the rds_ib_device can no longer be released.
>
> Store the reference in ibmr->device and drop it in the worker after
> the MR has been deregistered, which also keeps the device and its PD
> alive for as long as the MR exists.
>
> Fixes: 2eafa1746f17 ("net/rds: Handle ODP mr registration/unregistration")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Hi Wentao,
Thanks for the patch. The fix itself looks reasonable, but few things to update: since
this is a bug fix, it should should target net with [PATCH net v2]. The commit message
should mention how this was found, and whether it was tested. Reproducing this needs an
ODP-capable device, so if it was only build-tested, please say so. It looks like there's
a few check patch nits to work through as well:
https://patchwork.kernel.org/project/netdevbpf/patch/20261104022810.1484182-1-vulab@iscas.ac.cn/
Other than that it looks straight forward to me.
Thanks,
Allison
> ---
> net/rds/ib_rdma.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c
> index db7e92e7bd29..8cd8295f66a3 100644
> --- a/net/rds/ib_rdma.c
> +++ b/net/rds/ib_rdma.c
> @@ -591,6 +591,7 @@ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents,
> }
> ibmr->u.mr = ib_mr;
> ibmr->odp = 1;
> + ibmr->device = rds_ibdev;
>
> sge.addr = virt_addr;
> sge.length = length;
> @@ -697,5 +698,6 @@ static void rds_ib_odp_mr_worker(struct work_struct *work)
>
> ibmr = container_of(work, struct rds_ib_mr, work.work);
> ib_dereg_mr(ibmr->u.mr);
> + rds_ib_dev_put(ibmr->device);
> kfree(ibmr);
> }
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] net/rds: drop the device reference for ODP memory regions
2026-11-04 2:28 [PATCH] net/rds: drop the device reference for ODP memory regions Wentao Liang
` (2 preceding siblings ...)
2026-11-04 22:15 ` Allison Henderson
@ 2026-11-08 3:04 ` netdev-bot+sashiko
3 siblings, 0 replies; 5+ messages in thread
From: netdev-bot+sashiko @ 2026-11-08 3:04 UTC (permalink / raw)
To: vulab
Cc: achender, davem, edumazet, kuba, pabeni, horms, netdev,
linux-rdma, rds-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The patch adds rds_ib_dev_put(ibmr->device) to
rds_ib_odp_mr_worker() (net/rds/ib_rdma.c:701).
--
net/rds: drop the device reference for ODP memory regions
The ODP path in rds_ib_get_mr() takes a reference on the rds_ib_device
but never stores or drops it, so the reference leaks. This patch stores
the device in ibmr->device. It drops the reference in
rds_ib_odp_mr_worker() after the MR has been deregistered.
> diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c
> index db7e92e7bd29f..8cd8295f66a39 100644
> --- a/net/rds/ib_rdma.c
> +++ b/net/rds/ib_rdma.c
[ ... ]
> @@ -697,5 +698,6 @@ static void rds_ib_odp_mr_worker(struct work_struct *work)
>
> ibmr = container_of(work, struct rds_ib_mr, work.work);
> ib_dereg_mr(ibmr->u.mr);
> + rds_ib_dev_put(ibmr->device);
[Severity: High]
Can this put now race with unloading the rds_rdma module?
After this change, the ODP worker on rds_ib_mr_wq can drop the last
rds_ib_device reference. The final put queues module code on rds_wq,
and rds_wq belongs to rds core:
net/rds/ib.c:rds_ib_dev_put() {
...
if (refcount_dec_and_test(&rds_ibdev->refcount))
queue_work(rds_wq, &rds_ibdev->free_work);
}
The exit path flushes rds_wq only once, in rds_ib_unregister_client().
That happens before rds_ib_mr_wq is drained:
rds_ib_exit()
rds_ib_unregister_client()
ib_unregister_client(&rds_ib_client);
/* wait for rds_ib_dev_free() to complete */
flush_workqueue(rds_wq);
rds_ib_destroy_nodev_conns();
...
rds_ib_mr_exit()
destroy_workqueue(rds_ib_mr_wq);
An ODP worker can still be pending when that flush runs. For example,
closing an RDS socket that owns an ODP MR goes through:
rds_release()
rds_rdma_drop_keys()
__rds_put_mr_final()
rds_destroy_mr()
rds_ib_free_mr()
queue_delayed_work(rds_ib_mr_wq, &ibmr->work, 0);
...
rds_trans_put(rs->rs_transport);
Once rds_trans_put() drops the module reference, rmmod rds_rdma can go
ahead while that worker is still queued.
ODP workers can also be queued after the rds_wq flush. Messages on
nodev connections that carry op_odp_mr go through
rds_ib_destroy_nodev_conns() -> rds_conn_destroy() -> rds_rdma_free_op().
The worker might run on its own, or be drained by destroy_workqueue() in
rds_ib_mr_exit(). Either way, if it drops the final reference,
rds_ib_dev_free() is queued on rds_wq and nothing waits for it.
Could that work then run after the rds_rdma module text has been freed,
and touch the pools and PD after the module is gone?
Before this patch the ODP reference was leaked, so this ordering could
not happen. The comment above rds_ib_mr_exit() says the pool flushing
work queue should be idle by then, and that no longer seems to hold.
Would it make sense to flush rds_ib_mr_wq before the
flush_workqueue(rds_wq) in rds_ib_unregister_client()? Another option
would be to flush rds_wq again after rds_ib_mr_exit().
> kfree(ibmr);
> }
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261104022810.1484182-1-vulab%40iscas.ac.cn
^ permalink raw reply [flat|nested] 5+ messages in thread