diff options
author | Kevin Wolf <kwolf@redhat.com> | 2015-12-16 14:00:36 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-01-20 13:36:23 +0100 |
commit | 09e0c771e47e02278c264bafff6bfc0771732d72 (patch) | |
tree | 1825203d583618b74bd7e2b493d1d51fce0840eb /block/io.c | |
parent | b527c9b392a87abff698ca435da0dfa2bd6324a2 (diff) |
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
diff --git a/block/io.c b/block/io.c index 707c04ba48..23729942bc 100644 --- a/block/io.c +++ b/block/io.c @@ -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)) { |