Skip to content

Commit

Permalink
vhdx: Require GRAPH_RDLOCK for accessing a node's parent list
Browse files Browse the repository at this point in the history
This adds GRAPH_RDLOCK annotations to declare that functions accessing
the parent list of a node need to hold a reader lock for the graph. As
it happens, they already do.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20230504115750.54437-12-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
kevmw committed May 10, 2023
1 parent 69aa0d3 commit 622d30a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions block/vhdx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1506,8 +1506,9 @@ vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
* There are 2 headers, and the highest sequence number will represent
* the active header
*/
static int vhdx_create_new_headers(BlockBackend *blk, uint64_t image_size,
uint32_t log_size)
static int coroutine_fn GRAPH_RDLOCK
vhdx_create_new_headers(BlockBackend *blk, uint64_t image_size,
uint32_t log_size)
{
BlockDriverState *bs = blk_bs(blk);
BdrvChild *child;
Expand Down Expand Up @@ -1897,8 +1898,8 @@ static int vhdx_create_new_region_table(BlockBackend *blk,
* .---- ~ ----------- ~ ------------ ~ ---------------- ~ -----------.
* 1MB
*/
static int coroutine_fn vhdx_co_create(BlockdevCreateOptions *opts,
Error **errp)
static int coroutine_fn GRAPH_RDLOCK
vhdx_co_create(BlockdevCreateOptions *opts, Error **errp)
{
BlockdevCreateOptionsVhdx *vhdx_opts;
BlockBackend *blk = NULL;
Expand Down

0 comments on commit 622d30a

Please sign in to comment.