Re: [PATCH] RDMA/srp: Reserve send queue and CQ space for ib_drain_qp()

From: Bart Van Assche

Date: Tue Nov 10 2026 - 19:45:41 EST


On 11/10/26 2:24 PM, Praneeth Balasubramanian wrote:
> srp_destroy_qp() calls ib_drain_qp(), which also drains the send queue.
> ib_drain_sq() requires the caller to "ensure there is room in the CQ and
> SQ for the drain work request and completion".
>
> SRP reserves that room on the receive side, where the queue and CQ have
> queue_size + 1 entries. Commit 9294000d6d89 ("IB/srp: Drain the send
> queue before destroying a QP") switched from ib_drain_rq() to
> ib_drain_qp() but did not grow the send side.

Agreed. srp_destroy_qp() reaps the send CQ before it calls
ib_drain_qp(). After the QP has been moved into the error state, up to
m * queue_size flushed work requests may complete on the send CQ, and
the drain work request needs a free send queue slot. Hence, both the
send queue and the send CQ need one additional entry.

> Signed-off-by: Praneeth Balasubramanian <praneeth@xxxxxxxx>

The From: header of this email is praneethb2002@xxxxxxxxx while the
Signed-off-by: tag uses praneeth@xxxxxxxx. If this patch is applied
as-is, the gmail address will be recorded as the author. Please either
add an in-body "From: Praneeth Balasubramanian <praneeth@xxxxxxxx>" line
when reposting or make sure that both addresses match.

With that addressed:

Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>