* [PATCH] nvme-rdma: don't free I/O queues before cancelling requests
@ 2026-11-20 23:35 Stephane Thiell
2026-11-25 6:12 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Stephane Thiell @ 2026-11-20 23:35 UTC (permalink / raw)
To: linux-nvme; +Cc: kbusch, hch, sagi, axboe, sgogte, Stephane Thiell, stable
Since commit 2a8513091d2f ("nvme-rdma: parallelize I/O queue allocation
and startup"), the error path of nvme_rdma_setup_io_queues() frees the
queues of the batch. The caller cancels the outstanding requests only
afterwards.
This matters on a reconnect. Error recovery leaves the I/O queues
unquiesced, so a queue that went live can have requests in flight when
another queue of the same batch fails. The QP and the MR pools of the
live queue are then freed under those requests. When
nvme_cancel_tagset() completes them, each request with a registered MR
ends up in ib_mr_pool_put() on the freed QP.
Only stop the queues in the unwind, as nvme_rdma_start_io_queues() did
before that commit. The caller already calls nvme_rdma_free_io_queues()
after it has cancelled the requests.
Fixes: 2a8513091d2f ("nvme-rdma: parallelize I/O queue allocation and startup")
Cc: stable@vger.kernel.org
Signed-off-by: Stephane Thiell <sthiell@hudson-trading.com>
---
Found by code review, not reproduced. Build-tested (W=1) on
v7.4-rc3-602-g5f22fb20497f only.
drivers/nvme/host/rdma.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 32189fdfc0f5..c45e45dec287 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -748,19 +748,13 @@ static int nvme_rdma_setup_io_queues(struct nvme_rdma_ctrl *ctrl,
ret = READ_ONCE(err);
if (ret)
- goto out_free_queues;
+ goto out_stop_queues;
return 0;
-out_free_queues:
- for (i = 0; i < nr_queues; i++) {
- struct nvme_rdma_queue *queue =
- &ctrl->queues[first + i];
-
- if (test_bit(NVME_RDMA_Q_LIVE, &queue->flags))
- nvme_rdma_stop_queue(queue);
- if (test_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags))
- nvme_rdma_free_queue(queue);
- }
+out_stop_queues:
+ /* don't free here: requests may still be outstanding */
+ for (i = 0; i < nr_queues; i++)
+ nvme_rdma_stop_queue(&ctrl->queues[first + i]);
return ret;
}
base-commit: 5f22fb20497f4983094131f00a734362300d22d2
--
2.39.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] nvme-rdma: don't free I/O queues before cancelling requests
2026-11-20 23:35 [PATCH] nvme-rdma: don't free I/O queues before cancelling requests Stephane Thiell
@ 2026-11-25 6:12 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2026-11-25 6:12 UTC (permalink / raw)
To: Stephane Thiell; +Cc: linux-nvme, kbusch, hch, sagi, axboe, sgogte, stable
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-25 6:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 23:35 [PATCH] nvme-rdma: don't free I/O queues before cancelling requests Stephane Thiell
2026-11-25 6:12 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox