diff options
Diffstat (limited to 'block/io.c')
-rw-r--r-- | block/io.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/block/io.c b/block/io.c index 91611ffb2a..684ea465c7 100644 --- a/block/io.c +++ b/block/io.c @@ -1980,17 +1980,24 @@ bdrv_co_rw_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos, bool is_read) { BlockDriver *drv = bs->drv; + int ret = -ENOTSUP; + + bdrv_inc_in_flight(bs); if (!drv) { - return -ENOMEDIUM; + ret = -ENOMEDIUM; } else if (drv->bdrv_load_vmstate) { - return is_read ? drv->bdrv_load_vmstate(bs, qiov, pos) - : drv->bdrv_save_vmstate(bs, qiov, pos); + if (is_read) { + ret = drv->bdrv_load_vmstate(bs, qiov, pos); + } else { + ret = drv->bdrv_save_vmstate(bs, qiov, pos); + } } else if (bs->file) { - return bdrv_co_rw_vmstate(bs->file->bs, qiov, pos, is_read); + ret = bdrv_co_rw_vmstate(bs->file->bs, qiov, pos, is_read); } - return -ENOTSUP; + bdrv_dec_in_flight(bs); + return ret; } static void coroutine_fn bdrv_co_rw_vmstate_entry(void *opaque) |