From c081a84cd2e56f739592fc7158c89b38a167b6f5 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Mon, 5 Jul 2021 17:42:00 +0000 Subject: [PATCH] nvme: always return success from delete_io_qpair It is not uncommon for delete_io_qpair to fail, for example when a controller is hot removed. So even if SQ or CQ deletion fails, continue with freeing resources and report success back up the stack. There is really nothing the application can do to account for this failing anyways. Upcoming patches will add additional checks to ensure failing delete_io_qpair status never gets propagated to the caller. Signed-off-by: Jim Harris Change-Id: Iac007c1eba30f7a8c4936b3ffb6c837f28ee12ae Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8658 Reviewed-by: Ziye Yang Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins --- lib/nvme/nvme_pcie_common.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/nvme/nvme_pcie_common.c b/lib/nvme/nvme_pcie_common.c index 6ca93225a..4ba7622e6 100644 --- a/lib/nvme/nvme_pcie_common.c +++ b/lib/nvme/nvme_pcie_common.c @@ -996,7 +996,7 @@ nvme_pcie_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ status = calloc(1, sizeof(*status)); if (!status) { SPDK_ERRLOG("Failed to allocate status tracker\n"); - return -ENOMEM; + goto free; } /* Delete the I/O submission queue */ @@ -1004,13 +1004,13 @@ nvme_pcie_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ if (rc != 0) { SPDK_ERRLOG("Failed to send request to delete_io_sq with rc=%d\n", rc); free(status); - return rc; + goto free; } if (nvme_wait_for_completion(ctrlr->adminq, status)) { if (!status->timed_out) { free(status); } - return -1; + goto free; } /* Now that the submission queue is deleted, the device is supposed to have @@ -1024,13 +1024,13 @@ nvme_pcie_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ if (rc != 0) { SPDK_ERRLOG("Failed to send request to delete_io_cq with rc=%d\n", rc); free(status); - return rc; + goto free; } if (nvme_wait_for_completion(ctrlr->adminq, status)) { if (!status->timed_out) { free(status); } - return -1; + goto free; } free(status);