[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/6] block/io: assert that BlockDriver->bdrv_co_*_snapshot_* are
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH 5/6] block/io: assert that BlockDriver->bdrv_co_*_snapshot_* are always called with graph rdlock taken |
Date: |
Wed, 16 Nov 2022 08:53:30 -0500 |
The only callers are other callback functions that already run with the
graph rdlock taken.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
block/io.c | 2 ++
include/block/block_int-common.h | 3 +++
2 files changed, 5 insertions(+)
diff --git a/block/io.c b/block/io.c
index 62c0b3a390..7d1d0c48b0 100644
--- a/block/io.c
+++ b/block/io.c
@@ -3449,6 +3449,7 @@ bdrv_co_preadv_snapshot(BdrvChild *child, int64_t offset,
int64_t bytes,
BlockDriver *drv = bs->drv;
int ret;
IO_CODE();
+ assert_bdrv_graph_readable();
if (!drv) {
return -ENOMEDIUM;
@@ -3474,6 +3475,7 @@ bdrv_co_snapshot_block_status(BlockDriverState *bs,
BlockDriver *drv = bs->drv;
int ret;
IO_CODE();
+ assert_bdrv_graph_readable();
if (!drv) {
return -ENOMEDIUM;
diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h
index 3064822508..03bd28e3c9 100644
--- a/include/block/block_int-common.h
+++ b/include/block/block_int-common.h
@@ -652,9 +652,12 @@ struct BlockDriver {
* - be able to select a specific snapshot
* - receive the snapshot's actual length (which may differ from bs's
* length)
+ *
+ * Called with graph rdlock taken.
*/
int coroutine_fn (*bdrv_co_preadv_snapshot)(BlockDriverState *bs,
int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset);
+ /* Called with graph rdlock taken. */
int coroutine_fn (*bdrv_co_snapshot_block_status)(BlockDriverState *bs,
bool want_zero, int64_t offset, int64_t bytes, int64_t *pnum,
int64_t *map, BlockDriverState **file);
--
2.31.1
- [PATCH 0/6] Protect the block layer with a rwlock: part 2, Emanuele Giuseppe Esposito, 2022/11/16
- [PATCH 5/6] block/io: assert that BlockDriver->bdrv_co_*_snapshot_* are always called with graph rdlock taken,
Emanuele Giuseppe Esposito <=
- [PATCH 6/6] block: assert that BlockDriver->bdrv_co_delete_file is always called with graph rdlock taken, Emanuele Giuseppe Esposito, 2022/11/16
- [PATCH 1/6] block: assert that bdrv_co_create is always called with graph rdlock taken, Emanuele Giuseppe Esposito, 2022/11/16
- [PATCH 4/6] block/dirty-bitmap: assert that BlockDriver->bdrv_co_*_dirty_bitmap are always called with graph rdlock taken, Emanuele Giuseppe Esposito, 2022/11/16
- [PATCH 3/6] block: assert that BlockDriver->bdrv_co_copy_range_{from/to} is always called with graph rdlock taken, Emanuele Giuseppe Esposito, 2022/11/16
- [PATCH 2/6] block: assert that BlockDriver->bdrv_co_{amend/create} are called with graph rdlock taken, Emanuele Giuseppe Esposito, 2022/11/16
- Re: [PATCH 0/6] Protect the block layer with a rwlock: part 2, Emanuele Giuseppe Esposito, 2022/11/21