diff options
Diffstat (limited to 'blockjob.c')
-rw-r--r-- | blockjob.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/blockjob.c b/blockjob.c index 29517ae162..931d675c0c 100644 --- a/blockjob.c +++ b/blockjob.c @@ -205,8 +205,14 @@ int block_job_add_bdrv(BlockJob *job, const char *name, BlockDriverState *bs, BdrvChild *c; bdrv_ref(bs); - c = bdrv_root_attach_child(bs, name, &child_job, perm, shared_perm, - job, errp); + if (job->job.aio_context != qemu_get_aio_context()) { + aio_context_release(job->job.aio_context); + } + c = bdrv_root_attach_child(bs, name, &child_job, job->job.aio_context, + perm, shared_perm, job, errp); + if (job->job.aio_context != qemu_get_aio_context()) { + aio_context_acquire(job->job.aio_context); + } if (c == NULL) { return -EPERM; } |