diff options
author | Kevin Wolf <kwolf@redhat.com> | 2015-12-16 14:00:36 +0100 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 19:28:25 -0600 |
commit | cb73494fad99c6cf9c5ac6345c59381be4d80af9 (patch) | |
tree | 249af60c27eb37edd0e37b3dab9a23d1ceb04ae4 /block/io.c | |
parent | 7dca9b8a9d54f8ea4e4a77e334656c7a5679df20 (diff) | |
download | hqemu-cb73494fad99c6cf9c5ac6345c59381be4d80af9.zip hqemu-cb73494fad99c6cf9c5ac6345c59381be4d80af9.tar.gz |
block: Assert no write requests under BDRV_O_INCOMING
As long as BDRV_O_INCOMING is set, the image file is only opened so we
have a file descriptor for it. We're definitely not supposed to modify
the image, it's still owned by the migration source.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block/io.c')
-rw-r--r-- | block/io.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -1301,6 +1301,7 @@ static int coroutine_fn bdrv_co_do_pwritev(BlockDriverState *bs, if (bs->read_only) { return -EPERM; } + assert(!(bs->open_flags & BDRV_O_INCOMING)); ret = bdrv_check_byte_request(bs, offset, bytes); if (ret < 0) { @@ -2462,6 +2463,7 @@ int coroutine_fn bdrv_co_discard(BlockDriverState *bs, int64_t sector_num, } else if (bs->read_only) { return -EPERM; } + assert(!(bs->open_flags & BDRV_O_INCOMING)); /* Do nothing if disabled. */ if (!(bs->open_flags & BDRV_O_UNMAP)) { |