diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/async.c | 4 | ||||
-rw-r--r-- | util/thread-pool.c | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/util/async.c b/util/async.c index aec8016d42..c54da7164e 100644 --- a/util/async.c +++ b/util/async.c @@ -114,9 +114,7 @@ int aio_bh_poll(AioContext *ctx) ret = 1; } bh->idle = 0; - aio_context_acquire(ctx); aio_bh_call(bh); - aio_context_release(ctx); } if (bh->deleted) { deleted = true; @@ -389,7 +387,9 @@ static void co_schedule_bh_cb(void *opaque) Coroutine *co = QSLIST_FIRST(&straight); QSLIST_REMOVE_HEAD(&straight, co_scheduled_next); trace_aio_co_schedule_bh_cb(ctx, co); + aio_context_acquire(ctx); qemu_coroutine_enter(co); + aio_context_release(ctx); } } diff --git a/util/thread-pool.c b/util/thread-pool.c index 6fba913529..7c9cec57e3 100644 --- a/util/thread-pool.c +++ b/util/thread-pool.c @@ -165,6 +165,7 @@ static void thread_pool_completion_bh(void *opaque) ThreadPool *pool = opaque; ThreadPoolElement *elem, *next; + aio_context_acquire(pool->ctx); restart: QLIST_FOREACH_SAFE(elem, &pool->head, all, next) { if (elem->state != THREAD_DONE) { @@ -191,6 +192,7 @@ restart: qemu_aio_unref(elem); } } + aio_context_release(pool->ctx); } static void thread_pool_cancel(BlockAIOCB *acb) |