From: sashiko-bot@kernel.org
To: "Md Haris Iqbal" <haris.iqbal@ionos.com>, linux-rdma@vger.kernel.org
Subject: Re: [PATCH 3/9] RDMA/rtrs-clt: Trigger error recovery when posting LOCAL_INV fails
Date: Mon, 23 Nov 2026 15:02:35 +0000 [thread overview]
Message-ID: <sashiko-outbox-229468@kernel.org> (raw)
In-Reply-To: <20261123143719.938876-4-haris.iqbal@ionos.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] RDMA/rtrs-clt: early return in complete_rdma_req() leaks DMA
mappings
--
commit 61b2b66e033c3217c1bebe6348e99899004f5550
Author: Jack Wang <jinpu.wang@ionos.com>
RDMA/rtrs-clt: Trigger error recovery when posting LOCAL_INV fails
This commit clears req->mr->need_inval and triggers RDMA error recovery
when rtrs_inv_rkey() fails synchronously in complete_rdma_req().
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> index de226e6ba1246..5ef912a472cda 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> @@ -436,6 +436,19 @@ static void complete_rdma_req(struct rtrs_clt_io_req *req, int errno,
> if (err) {
> rtrs_err_rl(con->c.path, "Send INV WR key=%#x: %pe\n",
> req->mr->rkey, ERR_PTR(err));
> + /*
> + * No LOCAL_INV completion will fire, so the
> + * rkey is still live on the HCA but we cannot
> + * invalidate it from this context. Clear
> + * need_inval so subsequent reapers don't
> + * wait on an invalidate that will never
> + * happen, and kick off error recovery so the
> + * QP (and MR) is torn down cleanly via
> + * fail_all_outstanding_reqs() ->
> + * complete_rdma_req(can_wait=true).
> + */
> + req->mr->need_inval = false;
> + rtrs_rdma_error_recovery(con);
> } else if (can_wait) {
> wait_for_completion(&req->inv_comp);
> }
[Severity: High]
Does complete_rdma_req() leak the DMA mapping on req->sglist when called
from fail_all_outstanding_reqs() on an in-flight request that still has
req->mr->need_inval set?
During recovery, rtrs_clt_stop_and_destroy_conns() drains QPs via
stop_cm() and then runs fail_all_outstanding_reqs(), which calls
complete_rdma_req() with can_wait = true and req->ref == 1.
complete_rdma_req() increments req->ref to 2 before rtrs_inv_rkey(), and
neither the if (err) branch (when posting to the stopped QP fails) nor the
else if (can_wait) branch (where rtrs_clt_inv_rkey_done() only signals
req->inv_comp without dropping a reference) decrements req->ref:
drivers/infiniband/ulp/rtrs/rtrs-clt.c:complete_rdma_req() {
...
refcount_inc(&req->ref);
err = rtrs_inv_rkey(req);
if (err) {
...
req->mr->need_inval = false;
rtrs_rdma_error_recovery(con);
} else if (can_wait) {
wait_for_completion(&req->inv_comp);
}
if (!refcount_dec_and_test(&req->ref))
return;
}
ib_dma_unmap_sg(clt_path->s.dev->ib_dev, req->sglist,
req->sg_cnt, req->dir);
...
}
refcount_dec_and_test(&req->ref) drops req->ref from 2 to 1 and returns
early, skipping ib_dma_unmap_sg() and the clt_path->stats->inflight
decrement right before fail_all_outstanding_reqs() fails over or completes
the request.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123143719.938876-1-haris.iqbal@ionos.com?part=3
next prev parent reply other threads:[~2026-11-23 15:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 14:37 [PATCH 0/9] Misc patches for RTRS Md Haris Iqbal
2026-11-23 14:37 ` [PATCH 1/9] RDMA/rtrs-clt: Add mpath_policy module parameter Md Haris Iqbal
2026-11-23 14:44 ` sashiko-bot
2026-11-23 14:37 ` [PATCH 2/9] RDMA/rtrs-clt: Fix refcount imbalance in rtrs_clt_write_req error path Md Haris Iqbal
2026-11-23 14:37 ` [PATCH 3/9] RDMA/rtrs-clt: Trigger error recovery when posting LOCAL_INV fails Md Haris Iqbal
2026-11-23 15:02 ` sashiko-bot [this message]
2026-11-23 14:37 ` [PATCH 4/9] RDMA/rtrs-srv: Fix processing messages for Big-Endian archs Md Haris Iqbal
2026-11-23 14:37 ` [PATCH 5/9] RDMA/rtrs-clt: rename pathname parameter to sessname in rtrs_clt_open() Md Haris Iqbal
2026-11-23 14:42 ` sashiko-bot
2026-11-23 14:37 ` [PATCH 6/9] RDMA/rtrs-clt: Fix reconnect jitter being applied in milliseconds Md Haris Iqbal
2026-11-23 14:37 ` [PATCH 7/9] RDMA/rtrs-clt: Back off the reconnect delay exponentially Md Haris Iqbal
2026-11-23 14:37 ` [PATCH 8/9] RDMA/rtrs-srv: Snapshot the READ request header instead of reusing it Md Haris Iqbal
2026-11-23 14:37 ` [PATCH 9/9] RDMA/rtrs-clt: Close all paths before freeing any in rtrs_clt_close() Md Haris Iqbal
2026-11-23 15:02 ` [PATCH 0/9] Misc patches for RTRS sashiko-bot
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=sashiko-outbox-229468@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=haris.iqbal@ionos.com \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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