diff --git a/blockjob.c b/blockjob.c index c095cc57cb..01b896b7e7 100644 --- a/blockjob.c +++ b/blockjob.c @@ -361,10 +361,12 @@ void block_job_sleep_ns(BlockJob *job, QEMUClockType type, int64_t ns) } job->busy = false; + if (!block_job_is_paused(job)) { + co_aio_sleep_ns(blk_get_aio_context(job->blk), type, ns); + } + /* The job can be paused while sleeping, so check this again */ if (block_job_is_paused(job)) { qemu_coroutine_yield(); - } else { - co_aio_sleep_ns(blk_get_aio_context(job->blk), type, ns); } job->busy = true; }