aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2-bitmap.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2023-09-29 16:51:49 +0200
committerKevin Wolf <kwolf@redhat.com>2023-10-12 16:31:33 +0200
commit0bb79c97fd8e355aca433f4331d7d45e7e72b4b6 (patch)
treef3fe385db7fe95942384ecc382ee644962b7a45d /block/qcow2-bitmap.c
parentbd131d6705b6996f2cdccee3db017af570ce91ad (diff)
qcow2: Mark qcow2_signal_corruption() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of qcow2_signal_corruption() need to hold a reader lock for the graph because it calls bdrv_get_node_name(), which accesses the parents list of a node. For some places, we know that they will hold the lock, but we don't have the GRAPH_RDLOCK annotations yet. In this case, add assume_graph_lock() with a FIXME comment. These places will be removed once everything is properly annotated. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20230929145157.45443-15-kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2-bitmap.c')
-rw-r--r--block/qcow2-bitmap.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
index 03dd91dfac..6996eab9e1 100644
--- a/block/qcow2-bitmap.c
+++ b/block/qcow2-bitmap.c
@@ -206,8 +206,9 @@ static int check_constraints_on_bitmap(BlockDriverState *bs,
return 0;
}
-static void clear_bitmap_table(BlockDriverState *bs, uint64_t *bitmap_table,
- uint32_t bitmap_table_size)
+static void GRAPH_RDLOCK
+clear_bitmap_table(BlockDriverState *bs, uint64_t *bitmap_table,
+ uint32_t bitmap_table_size)
{
BDRVQcow2State *s = bs->opaque;
int i;
@@ -261,7 +262,8 @@ fail:
return ret;
}
-static int free_bitmap_clusters(BlockDriverState *bs, Qcow2BitmapTable *tb)
+static int GRAPH_RDLOCK
+free_bitmap_clusters(BlockDriverState *bs, Qcow2BitmapTable *tb)
{
int ret;
uint64_t *bitmap_table;
@@ -732,8 +734,9 @@ out:
* Store bitmap list to qcow2 image as a bitmap directory.
* Everything is checked.
*/
-static int bitmap_list_store(BlockDriverState *bs, Qcow2BitmapList *bm_list,
- uint64_t *offset, uint64_t *size, bool in_place)
+static int GRAPH_RDLOCK
+bitmap_list_store(BlockDriverState *bs, Qcow2BitmapList *bm_list,
+ uint64_t *offset, uint64_t *size, bool in_place)
{
int ret;
uint8_t *dir;
@@ -831,8 +834,9 @@ fail:
* Bitmap List end
*/
-static int update_ext_header_and_dir_in_place(BlockDriverState *bs,
- Qcow2BitmapList *bm_list)
+static int GRAPH_RDLOCK
+update_ext_header_and_dir_in_place(BlockDriverState *bs,
+ Qcow2BitmapList *bm_list)
{
BDRVQcow2State *s = bs->opaque;
int ret;
@@ -879,8 +883,8 @@ static int update_ext_header_and_dir_in_place(BlockDriverState *bs,
*/
}
-static int update_ext_header_and_dir(BlockDriverState *bs,
- Qcow2BitmapList *bm_list)
+static int GRAPH_RDLOCK
+update_ext_header_and_dir(BlockDriverState *bs, Qcow2BitmapList *bm_list)
{
BDRVQcow2State *s = bs->opaque;
int ret;
@@ -1273,9 +1277,9 @@ out:
/* store_bitmap_data()
* Store bitmap to image, filling bitmap table accordingly.
*/
-static uint64_t *store_bitmap_data(BlockDriverState *bs,
- BdrvDirtyBitmap *bitmap,
- uint32_t *bitmap_table_size, Error **errp)
+static uint64_t * GRAPH_RDLOCK
+store_bitmap_data(BlockDriverState *bs, BdrvDirtyBitmap *bitmap,
+ uint32_t *bitmap_table_size, Error **errp)
{
int ret;
BDRVQcow2State *s = bs->opaque;
@@ -1372,7 +1376,8 @@ fail:
* Store bm->dirty_bitmap to qcow2.
* Set bm->table_offset and bm->table_size accordingly.
*/
-static int store_bitmap(BlockDriverState *bs, Qcow2Bitmap *bm, Error **errp)
+static int GRAPH_RDLOCK
+store_bitmap(BlockDriverState *bs, Qcow2Bitmap *bm, Error **errp)
{
int ret;
uint64_t *tb;