nvmf: return error when getting the NULL I/O channel

In the case that NVMe SSD itself has limited number of
hardware I/O QPairs, the corresponding abstraction of
I/O channel where upper module used to send I/Os down
will be NULL.

Add a check here for the NVMe-oF module and return the
error if the related I/O channel is NULL.

Change-Id: I97b799c6ecb026a01b0a414f1b49b949aa2407fd
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/416689
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
GangCao 2018-06-24 23:02:16 -04:00 committed by Changpeng Liu
parent 6fac5e5b23
commit 25a89b2ac3

View File

@ -885,6 +885,10 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
} else if (ns != NULL && sgroup->channels[i] == NULL) {
/* A namespace appeared but there is no channel yet */
sgroup->channels[i] = spdk_bdev_get_io_channel(ns->desc);
if (sgroup->channels[i] == NULL) {
SPDK_ERRLOG("Could not allocate I/O channel.\n");
return -ENOMEM;
}
} else {
/* A namespace was present before and didn't change. */
}