diff --git a/lib/util/io_channel.c b/lib/util/io_channel.c index 355878496..ca5e6e659 100644 --- a/lib/util/io_channel.c +++ b/lib/util/io_channel.c @@ -322,6 +322,15 @@ struct call_channel { spdk_channel_for_each_cpl cpl; }; +static void +_call_completion(void *ctx) +{ + struct call_channel *ch_ctx = ctx; + + ch_ctx->cpl(ch_ctx->io_device, ch_ctx->ctx); + free(ch_ctx); +} + static void _call_channel(void *ctx) { @@ -351,8 +360,7 @@ _call_channel(void *ctx) pthread_mutex_unlock(&g_devlist_mutex); - ch_ctx->cpl(ch_ctx->io_device, ch_ctx->ctx); - free(ch_ctx); + spdk_thread_send_msg(ch_ctx->orig_thread, _call_completion, ch_ctx); } void