mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 12:23:53 -06:00
qdev-properties-system: Lock AioContext for blk_insert_bs()
blk_insert_bs() requires that callers hold the AioContext lock for the node that should be inserted. Take it. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20230605085711.21261-3-kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
23e6c3c41b
commit
415275aed9
1 changed files with 6 additions and 2 deletions
|
@ -143,11 +143,15 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name,
|
||||||
* aware of iothreads require their BlockBackends to be in the main
|
* aware of iothreads require their BlockBackends to be in the main
|
||||||
* AioContext.
|
* AioContext.
|
||||||
*/
|
*/
|
||||||
ctx = iothread ? bdrv_get_aio_context(bs) : qemu_get_aio_context();
|
ctx = bdrv_get_aio_context(bs);
|
||||||
blk = blk_new(ctx, 0, BLK_PERM_ALL);
|
blk = blk_new(iothread ? ctx : qemu_get_aio_context(),
|
||||||
|
0, BLK_PERM_ALL);
|
||||||
blk_created = true;
|
blk_created = true;
|
||||||
|
|
||||||
|
aio_context_acquire(ctx);
|
||||||
ret = blk_insert_bs(blk, bs, errp);
|
ret = blk_insert_bs(blk, bs, errp);
|
||||||
|
aio_context_release(ctx);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue