Commit 8f5e4bfe authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

nvme: clarify required action when free_io_qpair fails



A very heinous error case is when a delete_io_sq or
delete_io_cq command fails when freeing a PCIe IO
qpair.  In that case we return an error to the caller,
and the resources are not freed.

Instead of trying to 'fix' this error case, let's
just tell the user that if freeing an IO qpair fails,
the user should reset the controller and try again.

Resetting the controller will do one of two things:

1) The subsequent create_cq/create_sq will succeed,
   at which point, trying to delete again should work
   fine.  (If it doesn't, it indicates some kind of
   horrendous SSD.)
2) The subsequent create_cq/create_sq will fail,
   at which point the entire ctrlr would fail and
   need to be detached. This could result in some
   leaked memory, but seems unavoidable.

Closes issue #716.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I218564080abec4d6b5ac0b861869ebfc7d99f2c3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6918


Community-CI: Broadcom CI
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatar <dongx.yi@intel.com>
parent 6156777b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1410,7 +1410,8 @@ spdk_nvme_qp_failure_reason spdk_nvme_ctrlr_get_admin_qp_failure_reason(
 *
 * \param qpair I/O queue pair to free.
 *
 * \return 0 on success, -1 on failure.
 * \return 0 on success, -1 on failure.  On failure, the caller should reset
 * the controller and try to free the io qpair again after the reset.
 */
int spdk_nvme_ctrlr_free_io_qpair(struct spdk_nvme_qpair *qpair);