BlockBackend *blk;
bool should_converge;
bool should_complete;
- bool completed;
} CancelJob;
-static void cancel_job_exit(Job *job)
-{
- CancelJob *s = container_of(job, CancelJob, common.job);
- s->completed = true;
-}
-
static void cancel_job_complete(Job *job, Error **errp)
{
CancelJob *s = container_of(job, CancelJob, common.job);
.user_resume = block_job_user_resume,
.drain = block_job_drain,
.run = cancel_job_run,
- .exit = cancel_job_exit,
.complete = cancel_job_complete,
},
};
job_complete(job, &error_abort);
job_enter(job);
- while (!s->completed) {
+ while (!job->deferred_to_main_loop) {
aio_poll(qemu_get_aio_context(), true);
}
+ assert(job->status == JOB_STATUS_READY);
+ aio_poll(qemu_get_aio_context(), true);
assert(job->status == JOB_STATUS_PENDING);
cancel_common(s);
job_complete(job, &error_abort);
job_enter(job);
- while (!s->completed) {
+ while (!job->deferred_to_main_loop) {
aio_poll(qemu_get_aio_context(), true);
}
+ assert(job->status == JOB_STATUS_READY);
+ aio_poll(qemu_get_aio_context(), true);
assert(job->status == JOB_STATUS_PENDING);
job_finalize(job, &error_abort);