Commit 683a6712 authored by Pawel Wodkowski's avatar Pawel Wodkowski Committed by Jim Harris
Browse files

bdev: return error code if get_io_channel callback fail



This is needed for proper IO channel allocation failure handling.

Change-Id: I795e5bcce5296a52c119d2300974b8cb3fc0d576
Signed-off-by: default avatarPawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/381187


Reviewed-by: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
parent 331f062b
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -687,7 +687,16 @@ spdk_bdev_channel_create(void *io_device, void *ctx_buf)

	ch->bdev = io_device;
	ch->channel = bdev->fn_table->get_io_channel(bdev->ctxt);
	if (!ch->channel) {
		return -1;
	}

	ch->mgmt_channel = spdk_get_io_channel(&g_bdev_mgr);
	if (!ch->mgmt_channel) {
		spdk_put_io_channel(ch->channel);
		return -1;
	}

	memset(&ch->stat, 0, sizeof(ch->stat));
	ch->io_outstanding = 0;
	TAILQ_INIT(&ch->queued_resets);
@@ -701,6 +710,8 @@ spdk_bdev_channel_create(void *io_device, void *ctx_buf)
		__itt_init_ittlib(NULL, 0);
		name = spdk_sprintf_alloc("spdk_bdev_%s_%p", ch->bdev->name, ch);
		if (!name) {
			spdk_put_io_channel(ch->channel);
			spdk_put_io_channel(ch->mgmt_channel);
			return -1;
		}
		ch->handle = __itt_string_handle_create(name);