[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 18/20] block: Mark bdrv_query_block_graph_info() and callers GRAP
From: |
Kevin Wolf |
Subject: |
[PATCH 18/20] block: Mark bdrv_query_block_graph_info() and callers GRAPH_RDLOCK |
Date: |
Tue, 25 Apr 2023 19:31:56 +0200 |
This adds GRAPH_RDLOCK annotations to declare that callers of
bdrv_query_block_graph_info() need to hold a reader lock for the graph
because it accesses the children list of a node.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
include/block/qapi.h | 7 ++++---
qemu-img.c | 2 ++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/include/block/qapi.h b/include/block/qapi.h
index 8773b9b191..18d48ddb70 100644
--- a/include/block/qapi.h
+++ b/include/block/qapi.h
@@ -25,6 +25,7 @@
#ifndef BLOCK_QAPI_H
#define BLOCK_QAPI_H
+#include "block/graph-lock.h"
#include "block/snapshot.h"
#include "qapi/qapi-types-block-core.h"
@@ -43,9 +44,9 @@ void bdrv_query_image_info(BlockDriverState *bs,
bool flat,
bool skip_implicit_filters,
Error **errp);
-void bdrv_query_block_graph_info(BlockDriverState *bs,
- BlockGraphInfo **p_info,
- Error **errp);
+void GRAPH_RDLOCK
+bdrv_query_block_graph_info(BlockDriverState *bs, BlockGraphInfo **p_info,
+ Error **errp);
void bdrv_snapshot_dump(QEMUSnapshotInfo *sn);
void bdrv_image_info_specific_dump(ImageInfoSpecific *info_spec,
diff --git a/qemu-img.c b/qemu-img.c
index 9aeac69fa6..9f9f0a7629 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2938,6 +2938,8 @@ 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
--
2.40.0
- [PATCH 13/20] block: Mark bdrv_co_get_allocated_file_size() and callers GRAPH_RDLOCK, (continued)
- [PATCH 13/20] block: Mark bdrv_co_get_allocated_file_size() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/04/25
- [PATCH 14/20] block: Mark bdrv_co_get_info() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/04/25
- [PATCH 08/20] block: .bdrv_open is non-coroutine and unlocked, Kevin Wolf, 2023/04/25
- [PATCH 09/20] nbd: Remove nbd_co_flush() wrapper function, Kevin Wolf, 2023/04/25
- [PATCH 12/20] mirror: Take graph lock for accessing a node's parent list, Kevin Wolf, 2023/04/25
- [PATCH 18/20] block: Mark bdrv_query_block_graph_info() and callers GRAPH_RDLOCK,
Kevin Wolf <=
- [PATCH 19/20] block: Mark bdrv_recurse_can_replace() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/04/25
- [PATCH 20/20] block: Mark bdrv_refresh_limits() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/04/25
- [PATCH 17/20] block: Mark bdrv_query_bds_stats() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/04/25
- [PATCH 16/20] block: Mark BlockDriver callbacks for amend job GRAPH_RDLOCK, Kevin Wolf, 2023/04/25