summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Cody <jcody@redhat.com>2017-11-07 08:10:34 -0500
committerMax Reitz <mreitz@redhat.com>2017-11-14 18:06:25 +0100
commit6c7d390b993c4bbadd51ceeb41f7d2fdd68cb4fd (patch)
tree426bfba93492504910b6c625f9344ce5d4ada801
parent7479bf07c452cc5a3ace46f8e33fd60b25d12234 (diff)
downloadqemu-6c7d390b993c4bbadd51ceeb41f7d2fdd68cb4fd.tar.gz
block/parallels: Do not update header or truncate image when INMIGRATE
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 <aik@ozlabs.ru> Signed-off-by: Jeff Cody <jcody@redhat.com> Message-id: 3996c930fa8cde8570b7a63032720d76a28fd78b.1510059970.git.jcody@redhat.com Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Max Reitz <mreitz@redhat.com>
-rw-r--r--block/parallels.c7
1 files 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);
}