Commit 6439abc0 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

bdev/nvme: Ignore failure of I/O qpair creation if reconnect and retry are enabled



By a recent improvement, failure of I/O qpair creation is ignored
if the nvme_ctrlr is being reset or scheduled to reconnect.

However, failure of I/O qpair creation is not ignored if a new I/O
channel is allocated. It is normal to allocate a new I/O channel
when a nvme_ctrlr is being reset or scheduled to reconnect.

Fix this bug by relaxing the condition to ignore the result of
bdev_nvme_create_qpair() to if reconnect_delay_sec is non-zero and
bdev_retry_count is non-zero.

If reconnect_delay_sec is non-zero, reconnect will be tried sooner
or later, and if bdev_retry_count is non-zero, submitted IOs will be
queued until it succeeds.

Signed-off-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: Icf26e1ea65d292f9b8d24966abe25907d2cc33ec
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14446


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 7ad783c8
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -2305,12 +2305,15 @@ nvme_qpair_create(struct nvme_ctrlr *nvme_ctrlr, struct nvme_ctrlr_channel *ctrl

	rc = bdev_nvme_create_qpair(nvme_qpair);
	if (rc != 0) {
		/* nvme_ctrlr can't create IO qpair if connection is down. If nvme_ctrlr is
		 * being reset or scheduled to reconnect later, ignore this failure.
		 * Then IO qpair will be created later when reconnect completes.
		 * If the user submits IO requests in the meantime, they will be queued and
		 * resubmitted later */
		if (!nvme_ctrlr->resetting && !nvme_ctrlr->reconnect_is_delayed) {
		/* nvme_ctrlr can't create IO qpair if connection is down.
		 *
		 * If reconnect_delay_sec is non-zero, creating IO qpair is retried
		 * after reconnect_delay_sec seconds. If bdev_retry_count is non-zero,
		 * submitted IO will be queued until IO qpair is successfully created.
		 *
		 * Hence, if both are satisfied, ignore the failure.
		 */
		if (nvme_ctrlr->opts.reconnect_delay_sec == 0 || g_opts.bdev_retry_count == 0) {
			spdk_put_io_channel(pg_ch);
			free(nvme_qpair);
			return rc;