Commit 17e9f58f authored by Alexey Marchuk's avatar Alexey Marchuk Committed by Tomasz Zawadzki
Browse files

bdev/nvme: Handle failed IO qpair creation



It is possible that the application calls
get_io_channel during nvme controller reset.
In that case IO qpair won't be created and the
application will get a NULL pointer.
It is possible to repeat get_io_channel later but
there is no such indiciation for the application,
so it can't distinguish between a real failure and
"try again" case during controller reset.

This patch ignores IO qpair creation error if
controller is resetting. IO qpair will be created
when reset completes.

Signed-off-by: default avatarAlexey Marchuk <alexeymar@mellanox.com>
Change-Id: Id39202f5a6878453ff54e35df91d5dc49a5f046a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10828


Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuheimatsumoto@gmail.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 3c4a68ca
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1874,6 +1874,7 @@ bdev_nvme_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type)
static int
bdev_nvme_create_ctrlr_channel_cb(void *io_device, void *ctx_buf)
{
	struct nvme_ctrlr *nvme_ctrlr = io_device;
	struct nvme_ctrlr_channel *ctrlr_ch = ctx_buf;
	struct spdk_io_channel *pg_ch;
	int rc;
@@ -1897,8 +1898,13 @@ bdev_nvme_create_ctrlr_channel_cb(void *io_device, void *ctx_buf)

	rc = bdev_nvme_create_qpair(ctrlr_ch);
	if (rc != 0) {
		/* nvme ctrlr can't create IO qpair during reset. In that case ctrlr_ch->qpair
		 * pointer will be NULL and IO qpair will be created when reset completes.
		 * If the user submits IO requests during reset, they will be queued and resubmitted later */
		if (!nvme_ctrlr->resetting) {
			goto err_qpair;
		}
	}

	return 0;