Skip to content

Commit

Permalink
block: assert no image modification under BDRV_O_INACTIVE
Browse files Browse the repository at this point in the history
As long as BDRV_O_INACTIVE 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.

This commit is an addition to 09e0c77 but the assert() is added to
bdrv_truncate().

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Max Reitz <mreitz@redhat.com>
Message-id: 1491405505-31620-3-git-send-email-den@openvz.org
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
  • Loading branch information
Denis V. Lunev authored and XanClic committed Apr 28, 2017
1 parent d4a7f45 commit 504c205
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions block.c
Expand Up @@ -3328,6 +3328,8 @@ int bdrv_truncate(BdrvChild *child, int64_t offset, Error **errp)
return -EACCES;
}

assert(!(bs->open_flags & BDRV_O_INACTIVE));

ret = drv->bdrv_truncate(bs, offset, errp);
if (ret == 0) {
ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS);
Expand Down

0 comments on commit 504c205

Please sign in to comment.