diff --git a/lib/nvme/nvme_qpair.c b/lib/nvme/nvme_qpair.c index f431909a1..0fc870155 100644 --- a/lib/nvme/nvme_qpair.c +++ b/lib/nvme/nvme_qpair.c @@ -985,13 +985,18 @@ nvme_qpair_submit_request(struct spdk_nvme_qpair *qpair, struct nvme_request *re if (spdk_unlikely(!STAILQ_EMPTY(&qpair->queued_req) && req->num_children == 0)) { /* - * requests that have no children should be sent to the transport after all + * Requests that have no children should be sent to the transport after all * currently queued requests. Requests with chilren will be split and go back - * through this path. + * through this path. We need to make an exception for the fabrics commands + * while the qpair is connecting to be able to send the connect command + * asynchronously. */ - STAILQ_INSERT_TAIL(&qpair->queued_req, req, stailq); - req->queued = true; - return 0; + if (req->cmd.opc != SPDK_NVME_OPC_FABRIC || + nvme_qpair_get_state(qpair) != NVME_QPAIR_CONNECTING) { + STAILQ_INSERT_TAIL(&qpair->queued_req, req, stailq); + req->queued = true; + return 0; + } } rc = _nvme_qpair_submit_request(qpair, req);