diff --git a/lib/util/io_channel.c b/lib/util/io_channel.c index 5a3609cc4..355878496 100644 --- a/lib/util/io_channel.c +++ b/lib/util/io_channel.c @@ -273,9 +273,11 @@ spdk_get_io_channel(void *io_device) return ch; } -void -spdk_put_io_channel(struct spdk_io_channel *ch) +static void +_spdk_put_io_channel(void *arg) { + struct spdk_io_channel *ch = arg; + if (ch->ref == 0) { SPDK_ERRLOG("ref already zero\n"); return; @@ -290,6 +292,12 @@ spdk_put_io_channel(struct spdk_io_channel *ch) } } +void +spdk_put_io_channel(struct spdk_io_channel *ch) +{ + spdk_thread_send_msg(ch->thread, _spdk_put_io_channel, ch); +} + void * spdk_io_channel_get_ctx(struct spdk_io_channel *ch) {