[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/6] block/dirty-bitmap: assert that BlockDriver->bdrv_co_*_dirty
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH 4/6] block/dirty-bitmap: assert that BlockDriver->bdrv_co_*_dirty_bitmap are always called with graph rdlock taken |
Date: |
Wed, 16 Nov 2022 08:53:29 -0500 |
The only callers are the respective bdrv_*_dirty_bitmap() functions that
take care of creating a new coroutine (that already takes the graph
rdlock).
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
block/dirty-bitmap.c | 2 ++
include/block/block_int-common.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
index 21cf592889..92c70a7282 100644
--- a/block/dirty-bitmap.c
+++ b/block/dirty-bitmap.c
@@ -392,6 +392,7 @@ int coroutine_fn
bdrv_co_remove_persistent_dirty_bitmap(BlockDriverState *bs, const char *name,
Error **errp)
{
+ assert_bdrv_graph_readable();
if (bs->drv && bs->drv->bdrv_co_remove_persistent_dirty_bitmap) {
return bs->drv->bdrv_co_remove_persistent_dirty_bitmap(bs, name, errp);
}
@@ -413,6 +414,7 @@ bdrv_co_can_store_new_dirty_bitmap(BlockDriverState *bs,
const char *name,
uint32_t granularity, Error **errp)
{
BlockDriver *drv = bs->drv;
+ assert_bdrv_graph_readable();
if (!drv) {
error_setg_errno(errp, ENOMEDIUM,
diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h
index 9e441cb93b..3064822508 100644
--- a/include/block/block_int-common.h
+++ b/include/block/block_int-common.h
@@ -789,9 +789,11 @@ struct BlockDriver {
void (*bdrv_drain_end)(BlockDriverState *bs);
bool (*bdrv_supports_persistent_dirty_bitmap)(BlockDriverState *bs);
+ /* Called with graph rdlock held. */
bool coroutine_fn (*bdrv_co_can_store_new_dirty_bitmap)(
BlockDriverState *bs, const char *name, uint32_t granularity,
Error **errp);
+ /* Called with graph rdlock held. */
int coroutine_fn (*bdrv_co_remove_persistent_dirty_bitmap)(
BlockDriverState *bs, const char *name, Error **errp);
};
--
2.31.1
- [PATCH 0/6] Protect the block layer with a rwlock: part 2, 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 2/6] block: assert that BlockDriver->bdrv_co_{amend/create} are called with graph rdlock taken, Emanuele Giuseppe Esposito, 2022/11/16
- [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 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 4/6] block/dirty-bitmap: assert that BlockDriver->bdrv_co_*_dirty_bitmap are always called with graph rdlock taken,
Emanuele Giuseppe Esposito <=
- [PATCH 5/6] block/io: assert that BlockDriver->bdrv_co_*_snapshot_* are always 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