All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] parallels: wrong call to bdrv_truncate
@ 2017-03-27 14:38 Denis V. Lunev
  2017-03-28 10:07 ` Stefan Hajnoczi
  2017-03-28 16:26 ` Kevin Wolf
  0 siblings, 2 replies; 9+ messages in thread
From: Denis V. Lunev @ 2017-03-27 14:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Denis V. Lunev, Stefan Hajnoczi

Parallels driver should not call bdrv_truncate if the image was opened
in the read-only mode. Without the patch
    qemu-img check harddisk.hds
asserts with
    bdrv_truncate: Assertion `child->perm & BLK_PERM_RESIZE' failed.

Parameters used on the write path are not needed if the image is opened
in the read-only mode.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reported-by: Edgar Kaziahmedov <edos@virtuozzo.mipt.ru>
CC: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/parallels.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/parallels.c b/block/parallels.c
index 6bf9375..4173b3f 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -687,7 +687,8 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
     if (local_err != NULL) {
         goto fail_options;
     }
-    if (!bdrv_has_zero_init(bs->file->bs) ||
+
+    if (!(flags & BDRV_O_RESIZE) || !bdrv_has_zero_init(bs->file->bs) ||
             bdrv_truncate(bs->file, bdrv_getlength(bs->file->bs)) != 0) {
         s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE;
     }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-03-29 15:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-27 14:38 [Qemu-devel] [PATCH 1/1] parallels: wrong call to bdrv_truncate Denis V. Lunev
2017-03-28 10:07 ` Stefan Hajnoczi
2017-03-28 16:26 ` Kevin Wolf
2017-03-28 17:12   ` Denis V. Lunev
2017-03-29 10:41     ` Kevin Wolf
2017-03-29 13:53       ` Denis V. Lunev
2017-03-29 14:11         ` Kevin Wolf
2017-03-29 14:18           ` Denis V. Lunev
2017-03-29 14:32             ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.