diff --git a/thread-pool.c b/thread-pool.c index 4cfd07893fb5..23888dcfc4d7 100644 --- a/thread-pool.c +++ b/thread-pool.c @@ -185,6 +185,12 @@ static void thread_pool_completion_bh(void *opaque) QLIST_REMOVE(elem, all); /* Read state before ret. */ smp_rmb(); + + /* Schedule ourselves in case elem->common.cb() calls aio_poll() to + * wait for another request that completed at the same time. + */ + qemu_bh_schedule(pool->completion_bh); + elem->common.cb(elem->common.opaque, elem->ret); qemu_aio_release(elem); goto restart;