diff --git a/include/block/aio.h b/include/block/aio.h index 6b0d52f732..20fe7eab74 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -84,6 +84,9 @@ struct AioContext { */ uint32_t notify_me; + /* force to notify for qemu-img convert */ + bool notify_for_convert; + /* A lock to protect between QEMUBH and AioHandler adders and deleter, * and to ensure that no callbacks are removed while we're walking and * dispatching them. diff --git a/qemu-img.c b/qemu-img.c index 95a24b9762..fa87265bd7 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -2525,6 +2525,9 @@ static int img_convert(int argc, char **argv) s.unallocated_blocks_are_zero = bdi.unallocated_blocks_are_zero; } + AioContext *ctx = qemu_get_aio_context(); + ctx->notify_for_convert = 1; + ret = convert_do_copy(&s); out: if (!ret) { diff --git a/util/async.c b/util/async.c index b1fa5319e5..e99c3fa92a 100644 --- a/util/async.c +++ b/util/async.c @@ -346,7 +346,7 @@ void aio_notify(AioContext *ctx) * with atomic_or in aio_ctx_prepare or atomic_add in aio_poll. */ smp_mb(); - if (ctx->notify_me) { + if (ctx->notify_me || ctx->notify_for_convert) { event_notifier_set(&ctx->notifier); atomic_mb_set(&ctx->notified, true); } -- 2.17.1