Skip to content
Snippets Groups Projects
Commit 09e0c771 authored by Kevin Wolf's avatar Kevin Wolf
Browse files

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: default avatarKevin Wolf <kwolf@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
parent b527c9b3
No related branches found
No related tags found
No related merge requests found
......@@ -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)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment