[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/23] block: Mark bdrv_co_pwrite_sync() and callers GRAPH_RDLOCK
From: |
Kevin Wolf |
Subject: |
[PATCH 12/23] block: Mark bdrv_co_pwrite_sync() and callers GRAPH_RDLOCK |
Date: |
Fri, 3 Feb 2023 16:21:51 +0100 |
This adds GRAPH_RDLOCK annotations to declare that callers of
bdrv_co_pwrite_sync() need to hold a reader lock for the graph.
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>
---
block/qcow2.h | 2 +-
include/block/block-io.h | 7 ++++---
block/io.c | 3 +--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/block/qcow2.h b/block/qcow2.h
index 7487bcfcf9..c59e33c01c 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -893,7 +893,7 @@ int qcow2_inc_refcounts_imrt(BlockDriverState *bs,
BdrvCheckResult *res,
int qcow2_change_refcount_order(BlockDriverState *bs, int refcount_order,
BlockDriverAmendStatusCB *status_cb,
void *cb_opaque, Error **errp);
-int coroutine_fn qcow2_shrink_reftable(BlockDriverState *bs);
+int coroutine_fn GRAPH_RDLOCK qcow2_shrink_reftable(BlockDriverState *bs);
int64_t qcow2_get_last_cluster(BlockDriverState *bs, int64_t size);
int coroutine_fn qcow2_detect_metadata_preallocation(BlockDriverState *bs);
diff --git a/include/block/block-io.h b/include/block/block-io.h
index ec26f07d60..bbe8a5659a 100644
--- a/include/block/block-io.h
+++ b/include/block/block-io.h
@@ -60,9 +60,10 @@ int co_wrapper_mixed_bdrv_rdlock
bdrv_pwrite_sync(BdrvChild *child, int64_t offset, int64_t bytes,
const void *buf, BdrvRequestFlags flags);
-int coroutine_fn bdrv_co_pwrite_sync(BdrvChild *child, int64_t offset,
- int64_t bytes, const void *buf,
- BdrvRequestFlags flags);
+int coroutine_fn GRAPH_RDLOCK
+bdrv_co_pwrite_sync(BdrvChild *child, int64_t offset, int64_t bytes,
+ const void *buf, BdrvRequestFlags flags);
+
/*
* Efficiently zero a region of the disk image. Note that this is a regular
* I/O request like read or write and should have a reasonable size. This
diff --git a/block/io.c b/block/io.c
index 6f168a9a40..4ea19a37e6 100644
--- a/block/io.c
+++ b/block/io.c
@@ -933,8 +933,7 @@ int coroutine_fn bdrv_co_pwrite_sync(BdrvChild *child,
int64_t offset,
{
int ret;
IO_CODE();
-
- assume_graph_lock(); /* FIXME */
+ assert_bdrv_graph_readable();
ret = bdrv_co_pwrite(child, offset, bytes, buf, flags);
if (ret < 0) {
--
2.38.1
- Re: [PATCH 01/23] block: Make bdrv_can_set_read_only() static, (continued)
- [PATCH 03/23] block: Mark bdrv_co_truncate() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 04/23] block: Mark bdrv_co_block_status() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 06/23] block/qed: add missing graph rdlock in qed_need_check_timer_entry, Kevin Wolf, 2023/02/03
- [PATCH 02/23] mirror: Fix access of uninitialised fields during start, Kevin Wolf, 2023/02/03
- [PATCH 05/23] block: Mark bdrv_co_ioctl() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 08/23] block: Mark bdrv_co_pdiscard() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 09/23] block: Mark bdrv_co_pwrite_zeroes() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 10/23] block: Mark read/write in block/io.c GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 12/23] block: Mark bdrv_co_pwrite_sync() and callers GRAPH_RDLOCK,
Kevin Wolf <=
- [PATCH 07/23] block: Mark bdrv_co_flush() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 11/23] block: Mark public read/write functions GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 13/23] block: Mark bdrv_co_do_pwrite_zeroes() GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 15/23] block: Mark preadv_snapshot/snapshot_block_status GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 14/23] block: Mark bdrv_co_copy_range() GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 17/23] block: Mark bdrv_co_io_(un)plug() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 18/23] block: Mark bdrv_co_is_inserted() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 16/23] block: Mark bdrv_co_create() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 19/23] block: Mark bdrv_co_eject/lock_medium() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 20/23] block: Mark bdrv_(un)register_buf() GRAPH_RDLOCK, Kevin Wolf, 2023/02/03