aboutsummaryrefslogtreecommitdiff
path: root/blockjob.c
diff options
context:
space:
mode:
Diffstat (limited to 'blockjob.c')
-rw-r--r--blockjob.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/blockjob.c b/blockjob.c
index 9a97c73d77..a0d7e29b83 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -771,7 +771,14 @@ void block_job_resume_all(void)
void block_job_enter(BlockJob *job)
{
- if (job->co && !job->busy) {
+ if (!block_job_started(job)) {
+ return;
+ }
+ if (job->deferred_to_main_loop) {
+ return;
+ }
+
+ if (!job->busy) {
bdrv_coroutine_enter(blk_bs(job->blk), job->co);
}
}
@@ -899,7 +906,6 @@ static void block_job_defer_to_main_loop_bh(void *opaque)
aio_context_acquire(aio_context);
}
- data->job->deferred_to_main_loop = false;
data->fn(data->job, data->opaque);
if (aio_context != data->aio_context) {