nvme: abort queued admin requests during init

Abort any queued admin requests once admin queue gets enabled. A request
can get queued if a controller is being reset and it gets submitted
while admin qpair is being reconnected.  If these requests aren't
aborted, the init process will stall, as requests don't get resubmitted
while controller is resetting and subsequent admin commands required for
the initialization would be queued too.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: If456a297d2d434b3cc741816cbfb13b01d37e963
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9324
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Konrad Sztyber 2021-08-27 09:54:45 +02:00 committed by Tomasz Zawadzki
parent 38829de4d9
commit a4b7f87b61
4 changed files with 12 additions and 4 deletions

View File

@ -3700,6 +3700,12 @@ nvme_ctrlr_process_init(struct spdk_nvme_ctrlr *ctrlr)
case NVME_QPAIR_ENABLED:
nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_READ_VS,
NVME_TIMEOUT_INFINITE);
/* Abort any queued requests that were sent while the adminq was connecting
* to avoid stalling the init process during a reset, as requests don't get
* resubmitted while the controller is resetting and subsequent commands
* would get queued too.
*/
nvme_qpair_abort_queued_reqs(ctrlr->adminq, 0);
break;
default:
nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_ERROR, NVME_TIMEOUT_INFINITE);

View File

@ -1181,6 +1181,7 @@ int nvme_qpair_submit_request(struct spdk_nvme_qpair *qpair,
struct nvme_request *req);
void nvme_qpair_abort_reqs(struct spdk_nvme_qpair *qpair, uint32_t dnr);
uint32_t nvme_qpair_abort_queued_reqs_with_cbarg(struct spdk_nvme_qpair *qpair, void *cmd_cb_arg);
void nvme_qpair_abort_queued_reqs(struct spdk_nvme_qpair *qpair, uint32_t dnr);
void nvme_qpair_resubmit_requests(struct spdk_nvme_qpair *qpair, uint32_t num_requests);
int nvme_ctrlr_identify_active_ns(struct spdk_nvme_ctrlr *ctrlr);
void nvme_ns_set_identify_data(struct spdk_nvme_ns *ns);

View File

@ -543,8 +543,8 @@ nvme_qpair_manual_complete_request(struct spdk_nvme_qpair *qpair,
nvme_free_request(req);
}
static void
_nvme_qpair_abort_queued_reqs(struct spdk_nvme_qpair *qpair, uint32_t dnr)
void
nvme_qpair_abort_queued_reqs(struct spdk_nvme_qpair *qpair, uint32_t dnr)
{
struct nvme_request *req;
STAILQ_HEAD(, nvme_request) tmp;
@ -853,7 +853,7 @@ nvme_qpair_deinit(struct spdk_nvme_qpair *qpair)
{
struct nvme_error_cmd *cmd, *entry;
_nvme_qpair_abort_queued_reqs(qpair, 1);
nvme_qpair_abort_queued_reqs(qpair, 1);
_nvme_qpair_complete_abort_queued_reqs(qpair);
nvme_qpair_complete_error_reqs(qpair);
@ -1060,7 +1060,7 @@ void
nvme_qpair_abort_reqs(struct spdk_nvme_qpair *qpair, uint32_t dnr)
{
nvme_qpair_complete_error_reqs(qpair);
_nvme_qpair_abort_queued_reqs(qpair, dnr);
nvme_qpair_abort_queued_reqs(qpair, dnr);
_nvme_qpair_complete_abort_queued_reqs(qpair);
nvme_transport_qpair_abort_reqs(qpair, dnr);
}

View File

@ -81,6 +81,7 @@ DEFINE_STUB(spdk_nvme_ctrlr_cmd_security_receive, int, (struct spdk_nvme_ctrlr *
DEFINE_STUB(spdk_nvme_ctrlr_cmd_security_send, int, (struct spdk_nvme_ctrlr *ctrlr,
uint8_t secp, uint16_t spsp, uint8_t nssf, void *payload,
uint32_t payload_size, spdk_nvme_cmd_cb cb_fn, void *cb_arg), 0);
DEFINE_STUB_V(nvme_qpair_abort_queued_reqs, (struct spdk_nvme_qpair *qpair, uint32_t dnr));
DEFINE_RETURN_MOCK(nvme_transport_ctrlr_get_memory_domains, int);
int