nvmf/rdma: Fix search for req to abort when SRQ enabled

When SRQ is enabled, all qpairs share common pool of
rdma requests and we should check that rdma_req which
cid matches belongs to the correct qpair.

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6110 (master)

(cherry picked from commit 137866e573)
Change-Id: I2505ca39c5110e8e67a48abbe34b6df9ff00229f
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6146
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Alexey Marchuk 2021-01-27 09:26:24 +03:00 committed by Tomasz Zawadzki
parent 312a9d603d
commit 081cd04ea2

View File

@ -4106,19 +4106,24 @@ nvmf_rdma_qpair_abort_request(struct spdk_nvmf_qpair *qpair,
struct spdk_nvmf_rdma_transport *rtransport;
struct spdk_nvmf_transport *transport;
uint16_t cid;
uint32_t i;
struct spdk_nvmf_rdma_request *rdma_req_to_abort = NULL;
uint32_t i, max_req_count;
struct spdk_nvmf_rdma_request *rdma_req_to_abort = NULL, *rdma_req;
rqpair = SPDK_CONTAINEROF(qpair, struct spdk_nvmf_rdma_qpair, qpair);
rtransport = SPDK_CONTAINEROF(qpair->transport, struct spdk_nvmf_rdma_transport, transport);
transport = &rtransport->transport;
cid = req->cmd->nvme_cmd.cdw10_bits.abort.cid;
max_req_count = rqpair->srq == NULL ? rqpair->max_queue_depth : rqpair->poller->max_srq_depth;
for (i = 0; i < rqpair->max_queue_depth; i++) {
if (rqpair->resources->reqs[i].state != RDMA_REQUEST_STATE_FREE &&
rqpair->resources->reqs[i].req.cmd->nvme_cmd.cid == cid) {
rdma_req_to_abort = &rqpair->resources->reqs[i];
for (i = 0; i < max_req_count; i++) {
rdma_req = &rqpair->resources->reqs[i];
/* When SRQ == NULL, rqpair has its own requests and req.qpair pointer always points to the qpair
* When SRQ != NULL all rqpairs share common requests and qpair pointer is assigned when we start to
* process a request. So in both cases all requests which are not in FREE state have valid qpair ptr */
if (rdma_req->state != RDMA_REQUEST_STATE_FREE && rdma_req->req.cmd->nvme_cmd.cid == cid &&
rdma_req->req.qpair == qpair) {
rdma_req_to_abort = rdma_req;
break;
}
}