[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/6] block: assert that bdrv_co_create is always called with grap
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH 1/6] block: assert that bdrv_co_create is always called with graph rdlock taken |
Date: |
Wed, 16 Nov 2022 08:53:26 -0500 |
This function is either called by bdrv_create(), which always takes
care of creating a new coroutine, or by bdrv_create_file(), which
is only called by BlockDriver->bdrv_co_create_opts callbacks,
invoked by bdrv_co_create().
Protecting bdrv_co_create() implies that BlockDriver->bdrv_co_create_opts
is always called with graph rdlock taken.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
block.c | 1 +
include/block/block_int-common.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/block.c b/block.c
index c7611bed9e..e54ed300d7 100644
--- a/block.c
+++ b/block.c
@@ -537,6 +537,7 @@ int coroutine_fn bdrv_co_create(BlockDriver *drv, const
char *filename,
assert(qemu_in_coroutine());
assert(*errp == NULL);
assert(drv);
+ assert_bdrv_graph_readable();
if (!drv->bdrv_co_create_opts) {
error_setg(errp, "Driver '%s' does not support image creation",
diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h
index db97d61836..d45961a1d1 100644
--- a/include/block/block_int-common.h
+++ b/include/block/block_int-common.h
@@ -253,6 +253,7 @@ struct BlockDriver {
int coroutine_fn (*bdrv_co_create)(BlockdevCreateOptions *opts,
Error **errp);
+ /* Called with graph rdlock taken */
int coroutine_fn (*bdrv_co_create_opts)(BlockDriver *drv,
const char *filename,
QemuOpts *opts,
--
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, 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 1/6] block: assert that bdrv_co_create is always called with graph rdlock taken,
Emanuele Giuseppe Esposito <=
- [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