[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/28] block: Mark bdrv_child_perm() GRAPH_RDLOCK
From: |
Kevin Wolf |
Subject: |
[PULL 15/28] block: Mark bdrv_child_perm() GRAPH_RDLOCK |
Date: |
Fri, 15 Sep 2023 16:43:31 +0200 |
This adds GRAPH_RDLOCK annotations to declare that callers of
bdrv_child_perm() need to hold a reader lock for the graph because
some implementations access the children list of a node.
The callers of bdrv_child_perm() conveniently already hold the lock.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20230911094620.45040-16-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
include/block/block_int-common.h | 10 +++++-----
block.c | 11 ++++++-----
block/copy-before-write.c | 10 +++++-----
3 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h
index f82c14fb9c..3feb67ec4a 100644
--- a/include/block/block_int-common.h
+++ b/include/block/block_int-common.h
@@ -451,11 +451,11 @@ struct BlockDriver {
* permissions, but those that will be needed after applying the
* @reopen_queue.
*/
- void (*bdrv_child_perm)(BlockDriverState *bs, BdrvChild *c,
- BdrvChildRole role,
- BlockReopenQueue *reopen_queue,
- uint64_t parent_perm, uint64_t parent_shared,
- uint64_t *nperm, uint64_t *nshared);
+ void GRAPH_RDLOCK_PTR (*bdrv_child_perm)(
+ BlockDriverState *bs, BdrvChild *c, BdrvChildRole role,
+ BlockReopenQueue *reopen_queue,
+ uint64_t parent_perm, uint64_t parent_shared,
+ uint64_t *nperm, uint64_t *nshared);
/**
* Register/unregister a buffer for I/O. For example, when the driver is
diff --git a/block.c b/block.c
index 186efda70f..0f7f78f8de 100644
--- a/block.c
+++ b/block.c
@@ -2228,11 +2228,12 @@ bdrv_parent_perms_conflict(BlockDriverState *bs, Error
**errp)
return false;
}
-static void bdrv_child_perm(BlockDriverState *bs, BlockDriverState *child_bs,
- BdrvChild *c, BdrvChildRole role,
- BlockReopenQueue *reopen_queue,
- uint64_t parent_perm, uint64_t parent_shared,
- uint64_t *nperm, uint64_t *nshared)
+static void GRAPH_RDLOCK
+bdrv_child_perm(BlockDriverState *bs, BlockDriverState *child_bs,
+ BdrvChild *c, BdrvChildRole role,
+ BlockReopenQueue *reopen_queue,
+ uint64_t parent_perm, uint64_t parent_shared,
+ uint64_t *nperm, uint64_t *nshared)
{
assert(bs->drv && bs->drv->bdrv_child_perm);
GLOBAL_STATE_CODE();
diff --git a/block/copy-before-write.c b/block/copy-before-write.c
index 9a0e2b69d9..aeaff3bb82 100644
--- a/block/copy-before-write.c
+++ b/block/copy-before-write.c
@@ -341,11 +341,11 @@ static void cbw_refresh_filename(BlockDriverState *bs)
bs->file->bs->filename);
}
-static void cbw_child_perm(BlockDriverState *bs, BdrvChild *c,
- BdrvChildRole role,
- BlockReopenQueue *reopen_queue,
- uint64_t perm, uint64_t shared,
- uint64_t *nperm, uint64_t *nshared)
+static void GRAPH_RDLOCK
+cbw_child_perm(BlockDriverState *bs, BdrvChild *c, BdrvChildRole role,
+ BlockReopenQueue *reopen_queue,
+ uint64_t perm, uint64_t shared,
+ uint64_t *nperm, uint64_t *nshared)
{
if (!(role & BDRV_CHILD_FILTERED)) {
/*
--
2.41.0
- [PULL 16/28] block: Mark bdrv_parent_cb_change_media() GRAPH_RDLOCK, (continued)
- [PULL 16/28] block: Mark bdrv_parent_cb_change_media() GRAPH_RDLOCK, Kevin Wolf, 2023/09/15
- [PULL 22/28] block: add BDRV_BLOCK_COMPRESSED flag for bdrv_block_status(), Kevin Wolf, 2023/09/15
- [PULL 21/28] block: Mark bdrv_add/del_child() and caller GRAPH_WRLOCK, Kevin Wolf, 2023/09/15
- [PULL 23/28] qemu-img: map: report compressed data blocks, Kevin Wolf, 2023/09/15
- [PULL 19/28] block: Mark bdrv_root_unref_child() GRAPH_WRLOCK, Kevin Wolf, 2023/09/15
- [PULL 20/28] block: Mark bdrv_unref_child() GRAPH_WRLOCK, Kevin Wolf, 2023/09/15
- [PULL 09/28] block: Mark bdrv_replace_child_tran() GRAPH_WRLOCK, Kevin Wolf, 2023/09/15
- [PULL 07/28] block-coroutine-wrapper: Allow arbitrary parameter names, Kevin Wolf, 2023/09/15
- [PULL 11/28] block: Call transaction callbacks with lock held, Kevin Wolf, 2023/09/15
- [PULL 14/28] block: Mark bdrv_get_cumulative_perm() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/09/15
- [PULL 15/28] block: Mark bdrv_child_perm() GRAPH_RDLOCK,
Kevin Wolf <=
- [PULL 13/28] block: Mark bdrv_parent_perms_conflict() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/09/15
- [PULL 25/28] test-bdrv-drain: avoid race with BH in IOThread drain test, Kevin Wolf, 2023/09/15
- [PULL 26/28] block-backend: process I/O in the current AioContext, Kevin Wolf, 2023/09/15
- [PULL 24/28] block: remove AIOCBInfo->get_aio_context(), Kevin Wolf, 2023/09/15
- [PULL 28/28] block-coroutine-wrapper: use qemu_get_current_aio_context(), Kevin Wolf, 2023/09/15
- [PULL 27/28] block-backend: process zoned requests in the current AioContext, Kevin Wolf, 2023/09/15
- Re: [PULL 00/28] Block layer patches, Stefan Hajnoczi, 2023/09/18