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: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-on: https://review.gerrithub.io/381187 Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
331f062b93
commit
683a6712ee
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user