mirror of https://github.com/xemu-project/xemu.git
mirror: Hold main AioContext lock for calling bdrv_open_backing_file()
bdrv_open_backing_file() calls bdrv_open_inherit(), so all callers must hold the main AioContext lock. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20230525124713.401149-6-kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
4c20dd24b1
commit
2626d27f50
2
block.c
2
block.c
|
@ -3478,6 +3478,8 @@ int bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd,
|
||||||
* itself, all options starting with "${bdref_key}." are considered part of the
|
* itself, all options starting with "${bdref_key}." are considered part of the
|
||||||
* BlockdevRef.
|
* BlockdevRef.
|
||||||
*
|
*
|
||||||
|
* The caller must hold the main AioContext lock.
|
||||||
|
*
|
||||||
* TODO Can this be unified with bdrv_open_image()?
|
* TODO Can this be unified with bdrv_open_image()?
|
||||||
*/
|
*/
|
||||||
int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
|
int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
|
||||||
|
|
|
@ -662,11 +662,15 @@ static int mirror_exit_common(Job *job)
|
||||||
bool abort = job->ret < 0;
|
bool abort = job->ret < 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
GLOBAL_STATE_CODE();
|
||||||
|
|
||||||
if (s->prepared) {
|
if (s->prepared) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
s->prepared = true;
|
s->prepared = true;
|
||||||
|
|
||||||
|
aio_context_acquire(qemu_get_aio_context());
|
||||||
|
|
||||||
mirror_top_bs = s->mirror_top_bs;
|
mirror_top_bs = s->mirror_top_bs;
|
||||||
bs_opaque = mirror_top_bs->opaque;
|
bs_opaque = mirror_top_bs->opaque;
|
||||||
src = mirror_top_bs->backing->bs;
|
src = mirror_top_bs->backing->bs;
|
||||||
|
@ -789,6 +793,8 @@ static int mirror_exit_common(Job *job)
|
||||||
bdrv_unref(mirror_top_bs);
|
bdrv_unref(mirror_top_bs);
|
||||||
bdrv_unref(src);
|
bdrv_unref(src);
|
||||||
|
|
||||||
|
aio_context_release(qemu_get_aio_context());
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue