@@ -2633,6 +2633,7 @@ bdrv_co_readv_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos)
BlockDriverState *child_bs = bdrv_primary_bs(bs);
int ret;
IO_CODE();
+ assert_bdrv_graph_readable();
ret = bdrv_check_qiov_request(pos, qiov->size, qiov, 0, NULL);
if (ret < 0) {
@@ -2665,6 +2666,7 @@ bdrv_co_writev_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos)
BlockDriverState *child_bs = bdrv_primary_bs(bs);
int ret;
IO_CODE();
+ assert_bdrv_graph_readable();
ret = bdrv_check_qiov_request(pos, qiov->size, qiov, 0, NULL);
if (ret < 0) {
@@ -724,9 +724,11 @@ struct BlockDriver {
Error **errp);
BlockStatsSpecific *(*bdrv_get_specific_stats)(BlockDriverState *bs);
+ /* Called with graph rdlock held. */
int coroutine_fn (*bdrv_save_vmstate)(BlockDriverState *bs,
QEMUIOVector *qiov,
int64_t pos);
+ /* Called with graph rdlock held. */
int coroutine_fn (*bdrv_load_vmstate)(BlockDriverState *bs,
QEMUIOVector *qiov,
int64_t pos);
The only caller of these functions is bdrv_{read/write}v_vmstate, a generated_co_wrapper function that already takes the graph read lock. Protecting bdrv_co_{read/write}v_vmstate() implies that BlockDriver->bdrv_{load/save}_vmstate() is always called with graph rdlock taken. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> --- block/io.c | 2 ++ include/block/block_int-common.h | 2 ++ 2 files changed, 4 insertions(+)