@@ -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",
@@ -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,
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(+)