nvmf/vfio-user: return error when deleting SQ more than once

Previously we only use an assertion to address this sceanrio.

Fix issue #2173.

Change-Id: I7a6e715977218d2a3a08c48a9935880f3fe4ec63
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9604
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Andreas Economides <andreas.economides@nutanix.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Changpeng Liu 2021-09-24 18:20:15 +08:00 committed by Tomasz Zawadzki
parent 742ae4ec72
commit b3ddd46e0d

View File

@ -1290,12 +1290,19 @@ handle_del_io_q(struct nvmf_vfio_user_ctrlr *ctrlr,
spdk_nvmf_qpair_disconnect(&vu_qpair->qpair, vfio_user_qpair_delete_cb, ctx);
return 0;
} else {
if (vu_qpair->state == VFIO_USER_QPAIR_DELETED) {
SPDK_DEBUGLOG(nvmf_vfio, "%s: SQ%u is already deleted\n", ctrlr_id(ctrlr),
cmd->cdw10_bits.delete_io_q.qid);
sct = SPDK_NVME_SCT_COMMAND_SPECIFIC;
sc = SPDK_NVME_SC_INVALID_QUEUE_IDENTIFIER;
goto out;
}
/*
* This doesn't actually delete the SQ, We're merely telling the poll_group_poll
* function to skip checking this SQ. The queue pair will be disconnected in Delete
* IO CQ command.
*/
assert(vu_qpair->state == VFIO_USER_QPAIR_ACTIVE);
vu_qpair->state = VFIO_USER_QPAIR_DELETED;
}