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: GangCao <gang.cao@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14657 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
78ff96bb73
commit
13c7a98d33
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user