[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/18] qemu-img: Take graph lock more selectively
From: |
Kevin Wolf |
Subject: |
[PULL 11/18] qemu-img: Take graph lock more selectively |
Date: |
Wed, 17 May 2023 18:51:09 +0200 |
If we take a reader lock, we can't call any functions that take a writer
lock internally without causing deadlocks once the reader lock is
actually enforced in the main thread, too. Take the reader lock only
where it is actually needed.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20230510203601.418015-5-kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
qemu-img.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index 9f9f0a7629..27f48051b0 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2938,8 +2938,6 @@ static BlockGraphInfoList *collect_image_info_list(bool
image_opts,
}
bs = blk_bs(blk);
- GRAPH_RDLOCK_GUARD_MAINLOOP();
-
/*
* Note that the returned BlockGraphInfo object will not have
* information about this image's backing node, because we have opened
@@ -2947,7 +2945,10 @@ static BlockGraphInfoList *collect_image_info_list(bool
image_opts,
* duplicate the backing chain information that we obtain by walking
* the chain manually here.
*/
+ bdrv_graph_rdlock_main_loop();
bdrv_query_block_graph_info(bs, &info, &err);
+ bdrv_graph_rdunlock_main_loop();
+
if (err) {
error_report_err(err);
blk_unref(blk);
--
2.40.1
- [PULL 02/18] blockdev: transactions: rename some things, (continued)
- [PULL 02/18] blockdev: transactions: rename some things, Kevin Wolf, 2023/05/17
- [PULL 03/18] blockdev: qmp_transaction: refactor loop to classic for, Kevin Wolf, 2023/05/17
- [PULL 07/18] docs/interop/qcow2.txt: fix description about "zlib" clusters, Kevin Wolf, 2023/05/17
- [PULL 05/18] blockdev: use state.bitmap in block-dirty-bitmap-add action, Kevin Wolf, 2023/05/17
- [PULL 04/18] blockdev: transaction: refactor handling transaction properties, Kevin Wolf, 2023/05/17
- [PULL 06/18] blockdev: qmp_transaction: drop extra generic layer, Kevin Wolf, 2023/05/17
- [PULL 08/18] block: Call .bdrv_co_create(_opts) unlocked, Kevin Wolf, 2023/05/17
- [PULL 10/18] qcow2: Unlock the graph in qcow2_do_open() where necessary, Kevin Wolf, 2023/05/17
- [PULL 09/18] block/export: Fix null pointer dereference in error path, Kevin Wolf, 2023/05/17
- [PULL 12/18] test-bdrv-drain: Take graph lock more selectively, Kevin Wolf, 2023/05/17
- [PULL 11/18] qemu-img: Take graph lock more selectively,
Kevin Wolf <=
- [PULL 14/18] blockjob: Adhere to rate limit even when reentered early, Kevin Wolf, 2023/05/17
- [PULL 16/18] iotests/245: Check if 'compress' driver is available, Kevin Wolf, 2023/05/17
- [PULL 17/18] aio-posix: do not nest poll handlers, Kevin Wolf, 2023/05/17
- [PULL 15/18] graph-lock: Honour read locks even in the main thread, Kevin Wolf, 2023/05/17
- [PULL 18/18] tested: add test for nested aio_poll() in poll handlers, Kevin Wolf, 2023/05/17