nvme: move aborted requests to a separate queue before completion
This avoids an infite loop when user sends and then immediately aborts all requests while the transport cannot submit them (returning -EAGAIN). It might happen in two cases: 1) if the transport doesn't have any free requests or 2) if the qpair is still in the NVME_QPAIR_CONNECTING state. Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: Ia1d0b7c93f387524be0ad39597ec49851e1d3af7 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8711 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
f02e2328ae
commit
5b2e9b229c
@ -572,10 +572,18 @@ static void
|
|||||||
_nvme_qpair_complete_abort_queued_reqs(struct spdk_nvme_qpair *qpair)
|
_nvme_qpair_complete_abort_queued_reqs(struct spdk_nvme_qpair *qpair)
|
||||||
{
|
{
|
||||||
struct nvme_request *req;
|
struct nvme_request *req;
|
||||||
|
STAILQ_HEAD(, nvme_request) tmp;
|
||||||
|
|
||||||
while (!STAILQ_EMPTY(&qpair->aborting_queued_req)) {
|
if (spdk_likely(STAILQ_EMPTY(&qpair->aborting_queued_req))) {
|
||||||
req = STAILQ_FIRST(&qpair->aborting_queued_req);
|
return;
|
||||||
STAILQ_REMOVE_HEAD(&qpair->aborting_queued_req, stailq);
|
}
|
||||||
|
|
||||||
|
STAILQ_INIT(&tmp);
|
||||||
|
STAILQ_SWAP(&tmp, &qpair->aborting_queued_req, nvme_request);
|
||||||
|
|
||||||
|
while (!STAILQ_EMPTY(&tmp)) {
|
||||||
|
req = STAILQ_FIRST(&tmp);
|
||||||
|
STAILQ_REMOVE_HEAD(&tmp, stailq);
|
||||||
nvme_qpair_manual_complete_request(qpair, req, SPDK_NVME_SCT_GENERIC,
|
nvme_qpair_manual_complete_request(qpair, req, SPDK_NVME_SCT_GENERIC,
|
||||||
SPDK_NVME_SC_ABORTED_BY_REQUEST, 1, true);
|
SPDK_NVME_SC_ABORTED_BY_REQUEST, 1, true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user