[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/23] qdev-properties-system: Lock AioContext for blk_insert_bs()
From: |
Kevin Wolf |
Subject: |
[PULL 02/23] qdev-properties-system: Lock AioContext for blk_insert_bs() |
Date: |
Wed, 28 Jun 2023 16:15:05 +0200 |
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>
---
hw/core/qdev-properties-system.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index d42493f630..6d5d43eda2 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -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
* AioContext.
*/
- ctx = iothread ? bdrv_get_aio_context(bs) : qemu_get_aio_context();
- blk = blk_new(ctx, 0, BLK_PERM_ALL);
+ ctx = bdrv_get_aio_context(bs);
+ blk = blk_new(iothread ? ctx : qemu_get_aio_context(),
+ 0, BLK_PERM_ALL);
blk_created = true;
+ aio_context_acquire(ctx);
ret = blk_insert_bs(blk, bs, errp);
+ aio_context_release(ctx);
+
if (ret < 0) {
goto fail;
}
--
2.41.0
- [PULL 00/23] Block layer patches, Kevin Wolf, 2023/06/28
- [PULL 01/23] iotests: Test active commit with iothread and background I/O, Kevin Wolf, 2023/06/28
- [PULL 04/23] block: Fix AioContext locking in bdrv_open_child(), Kevin Wolf, 2023/06/28
- [PULL 02/23] qdev-properties-system: Lock AioContext for blk_insert_bs(),
Kevin Wolf <=
- [PULL 05/23] block: Fix AioContext locking in bdrv_attach_child_common(), Kevin Wolf, 2023/06/28
- [PULL 11/23] Revert "graph-lock: Disable locking for now", Kevin Wolf, 2023/06/28
- [PULL 06/23] block: Fix AioContext locking in bdrv_reopen_parse_file_or_backing(), Kevin Wolf, 2023/06/28
- [PULL 17/23] cloop: mark more functions as coroutine_fns and GRAPH_RDLOCK, Kevin Wolf, 2023/06/28
- [PULL 08/23] block: Fix AioContext locking in bdrv_open_backing_file(), Kevin Wolf, 2023/06/28
- [PULL 10/23] graph-lock: Unlock the AioContext while polling, Kevin Wolf, 2023/06/28
- [PULL 07/23] block: Fix AioContext locking in bdrv_open_inherit(), Kevin Wolf, 2023/06/28
- [PULL 14/23] vpc: mark more functions as coroutine_fns and GRAPH_RDLOCK, Kevin Wolf, 2023/06/28
- [PULL 13/23] qed: mark more functions as coroutine_fns and GRAPH_RDLOCK, Kevin Wolf, 2023/06/28
- [PULL 03/23] test-block-iothread: Lock AioContext for blk_insert_bs(), Kevin Wolf, 2023/06/28