[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 29/34] block: assert no image modification under BDRV
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 29/34] block: assert no image modification under BDRV_O_INACTIVE |
Date: |
Fri, 28 Apr 2017 22:33:37 +0200 |
From: "Denis V. Lunev" <address@hidden>
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 09e0c771 but the assert() is added to
bdrv_truncate().
Signed-off-by: Denis V. Lunev <address@hidden>
CC: Kevin Wolf <address@hidden>
CC: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
block.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block.c b/block.c
index 76bf00f..6c6bb3e 100644
--- a/block.c
+++ b/block.c
@@ -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);
--
1.8.3.1
- [Qemu-block] [PULL 19/34] block: fix alignment calculations in bdrv_co_do_zero_pwritev, (continued)
- [Qemu-block] [PULL 19/34] block: fix alignment calculations in bdrv_co_do_zero_pwritev, Kevin Wolf, 2017/04/28
- [Qemu-block] [PULL 20/34] qemu-img/convert: Use @opts for one thing only, Kevin Wolf, 2017/04/28
- [Qemu-block] [PULL 23/34] block/vhdx: Make vhdx_create() always set errp, Kevin Wolf, 2017/04/28
- [Qemu-block] [PULL 21/34] qemu-img/convert: Move bs_n > 1 && -B check down, Kevin Wolf, 2017/04/28
- [Qemu-block] [PULL 22/34] qemu-img: Document backing options, Kevin Wolf, 2017/04/28
- [Qemu-block] [PULL 24/34] block: Add errp to b{lk,drv}_truncate(), Kevin Wolf, 2017/04/28
- [Qemu-block] [PULL 27/34] qcow2: Allow discard of final unaligned cluster, Kevin Wolf, 2017/04/28
- [Qemu-block] [PULL 26/34] block: Add .bdrv_truncate() error messages, Kevin Wolf, 2017/04/28
- [Qemu-block] [PULL 28/34] block: fix obvious coding style mistakes in block_int.h, Kevin Wolf, 2017/04/28
- [Qemu-block] [PULL 25/34] block: Add errp to BD.bdrv_truncate(), Kevin Wolf, 2017/04/28
- [Qemu-block] [PULL 29/34] block: assert no image modification under BDRV_O_INACTIVE,
Kevin Wolf <=
- [Qemu-block] [PULL 32/34] iotests: clarify help text, Kevin Wolf, 2017/04/28
- [Qemu-block] [PULL 30/34] qemu-img: improve convert_iteration_sectors(), Kevin Wolf, 2017/04/28
- [Qemu-block] [PULL 31/34] qemu-img: use blk_co_pwrite_zeroes for zero sectors when compressed, Kevin Wolf, 2017/04/28
- [Qemu-block] [PULL 33/34] iotests: fix exclusion option, Kevin Wolf, 2017/04/28
- [Qemu-block] [PULL 34/34] progress: Show current progress on SIGINFO, Kevin Wolf, 2017/04/28