[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/26] block: Take graph rdlock in bdrv_inactivate_all()
From: |
Kevin Wolf |
Subject: |
[PULL 07/26] block: Take graph rdlock in bdrv_inactivate_all() |
Date: |
Thu, 12 Oct 2023 18:22:05 +0200 |
The function reads the parents list, so it needs to hold the graph lock.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20230929145157.45443-4-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index af04c8ac6f..b62f6f3841 100644
--- a/block.c
+++ b/block.c
@@ -6976,7 +6976,8 @@ void bdrv_activate_all(Error **errp)
}
}
-static bool bdrv_has_bds_parent(BlockDriverState *bs, bool only_active)
+static bool GRAPH_RDLOCK
+bdrv_has_bds_parent(BlockDriverState *bs, bool only_active)
{
BdrvChild *parent;
GLOBAL_STATE_CODE();
@@ -6993,14 +6994,13 @@ static bool bdrv_has_bds_parent(BlockDriverState *bs,
bool only_active)
return false;
}
-static int bdrv_inactivate_recurse(BlockDriverState *bs)
+static int GRAPH_RDLOCK bdrv_inactivate_recurse(BlockDriverState *bs)
{
BdrvChild *child, *parent;
int ret;
uint64_t cumulative_perms, cumulative_shared_perms;
GLOBAL_STATE_CODE();
- GRAPH_RDLOCK_GUARD_MAINLOOP();
if (!bs->drv) {
return -ENOMEDIUM;
@@ -7066,6 +7066,7 @@ int bdrv_inactivate_all(void)
GSList *aio_ctxs = NULL, *ctx;
GLOBAL_STATE_CODE();
+ GRAPH_RDLOCK_GUARD_MAINLOOP();
for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
AioContext *aio_context = bdrv_get_aio_context(bs);
--
2.41.0
- [PULL 00/26] Block layer patches, Kevin Wolf, 2023/10/12
- [PULL 05/26] test-bdrv-drain: Don't call bdrv_graph_wrlock() in coroutine context, Kevin Wolf, 2023/10/12
- [PULL 10/26] block: Mark bdrv_parent_cb_resize() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 01/26] block: rename the bdrv_co_block_status static function, Kevin Wolf, 2023/10/12
- [PULL 03/26] block: switch to co_wrapper for bdrv_is_allocated_*, Kevin Wolf, 2023/10/12
- [PULL 02/26] block: complete public block status API, Kevin Wolf, 2023/10/12
- [PULL 14/26] block: Mark bdrv_refresh_filename() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 11/26] block: Mark bdrv_snapshot_fallback() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 07/26] block: Take graph rdlock in bdrv_inactivate_all(),
Kevin Wolf <=
- [PULL 12/26] block: Take graph rdlock in parts of reopen, Kevin Wolf, 2023/10/12
- [PULL 18/26] qcow2: Mark qcow2_signal_corruption() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 13/26] block: Mark bdrv_get_xdbg_block_graph() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 09/26] block: Mark drain related functions GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 06/26] block-coroutine-wrapper: Add no_co_wrapper_bdrv_rdlock functions, Kevin Wolf, 2023/10/12
- [PULL 17/26] block: Mark bdrv_amend_options() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 19/26] qcow2: Mark qcow2_inactivate() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 04/26] block: convert more bdrv_is_allocated* and bdrv_block_status* calls to coroutine versions, Kevin Wolf, 2023/10/12
- [PULL 23/26] block: Mark bdrv_get_specific_info() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 22/26] block: Mark bdrv_apply_auto_read_only() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12