Commit 13c7a98d authored by GangCao's avatar GangCao Committed by Tomasz Zawadzki
Browse files

thread: add assert for io_channel_iter allocation failure



For example, in the calling from spdk_bdev_get_current_qd(), if
spdk_for_each_channel() failed to allocate struct spdk_io_channel_iter,
it will just return and the ctx allocated in spdk_bdev_get_current_qd()
is not released.

Instead to change the public API of spdk_for_each_channel() to return
the failed status to let the caller properly handle the NOMEM case and
release the allocation, it just adds the assert here.

Change-Id: I6a95207dd390586bdae4e86e5d550cdac709e10a
Signed-off-by: default avatarGangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14657


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 78ff96bb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2381,6 +2381,7 @@ spdk_for_each_channel(void *io_device, spdk_channel_msg fn, void *ctx,
	i = calloc(1, sizeof(*i));
	if (!i) {
		SPDK_ERRLOG("Unable to allocate iterator\n");
		assert(false);
		return;
	}