[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 18/20] block/parallels: Do not update header or trunc
From: |
Max Reitz |
Subject: |
[Qemu-block] [PULL 18/20] block/parallels: Do not update header or truncate image when INMIGRATE |
Date: |
Tue, 14 Nov 2017 18:24:15 +0100 |
From: Jeff Cody <address@hidden>
If we write or modify the image file while the QEMU run state is
INMIGRATE, then the BDRV_O_INACTIVE BDS flag is set. This will cause
an assert, since the image is marked inactive. Make sure we obey this
flag.
Tested-by: Alexey Kardashevskiy <address@hidden>
Signed-off-by: Jeff Cody <address@hidden>
Message-id: address@hidden
Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Denis V. Lunev <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
block/parallels.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/block/parallels.c b/block/parallels.c
index 2b6c6e5709..7b7a3efa1d 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -708,7 +708,7 @@ static int parallels_open(BlockDriverState *bs, QDict
*options, int flags,
s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE;
}
- if (flags & BDRV_O_RDWR) {
+ if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_INACTIVE)) {
s->header->inuse = cpu_to_le32(HEADER_INUSE_MAGIC);
ret = parallels_update_header(bs);
if (ret < 0) {
@@ -741,12 +741,9 @@ static void parallels_close(BlockDriverState *bs)
{
BDRVParallelsState *s = bs->opaque;
- if (bs->open_flags & BDRV_O_RDWR) {
+ if ((bs->open_flags & BDRV_O_RDWR) && !(bs->open_flags & BDRV_O_INACTIVE))
{
s->header->inuse = 0;
parallels_update_header(bs);
- }
-
- if (bs->open_flags & BDRV_O_RDWR) {
bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS,
PREALLOC_MODE_OFF, NULL);
}
--
2.13.6
- [Qemu-block] [PULL 08/20] iotests: Make 030 less flaky, (continued)
- [Qemu-block] [PULL 08/20] iotests: Make 030 less flaky, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 09/20] iotests: Add missing 'blkdebug::' in 040, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 10/20] iotests: Make 055 less flaky, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 11/20] iotests: Make 083 less flaky, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 12/20] iotests: Make 136 less flaky, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 13/20] iotests: Use new-style NBD connections, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 14/20] qcow2: Check that corrupted images can be repaired in iotest 060, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 16/20] iotests: 077: Filter out 'resume' lines, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 15/20] block/snapshot: dirty all dirty bitmaps on snapshot-switch, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 17/20] block/vhdx.c: Don't blindly update the header, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 18/20] block/parallels: Do not update header or truncate image when INMIGRATE,
Max Reitz <=
- [Qemu-block] [PULL 20/20] qemu-iotests: update unsupported image formats in 194, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 19/20] block/parallels: add migration blocker, Max Reitz, 2017/11/14
- Re: [Qemu-block] [PULL 00/20] Block patches for 2.11.0-rc1, Peter Maydell, 2017/11/14
- Re: [Qemu-block] [PULL 00/20] Block patches for 2.11.0-rc1, Peter Maydell, 2017/11/14