All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Cody <jcody@redhat.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, aik@ozlabs.ru,
	mreitz@redhat.com, den@openvz.org, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH v2 1/3] block/vhdx.c: Don't blindly update the header
Date: Mon, 30 Oct 2017 14:10:26 +0100	[thread overview]
Message-ID: <8d958396d786b6777c71de1a2138e92ef2915649.1509368614.git.jcody@redhat.com> (raw)
In-Reply-To: <cover.1509368614.git.jcody@redhat.com>
In-Reply-To: <cover.1509368614.git.jcody@redhat.com>

The VHDX specification requires that before user data modification of
the vhdx image, the VHDX header file and data GUIDs need to be updated.
In vhdx_open(), if the image is set to RDWR, we go ahead and update the
header.

However, just because the image is set to RDWR does not mean we can go
ahead and write at this point - specifically, if the QEMU run state is
INMIGRATE, the underlying file BS may be set to inactive via the BDS
open flag of BDRV_O_INACTIVE.  Attempting to write under this condition
will cause an assert in bdrv_co_pwritev().

We can alternatively latch the first time the image is written.  And lo
and behold, we do just that, via vhdx_user_visible_write() in
vhdx_co_writev().  This means the call to vhdx_update_headers() in
vhdx_open() is likely just vestigial, and can be removed.

Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Jeff Cody <jcody@redhat.com>
---
 block/vhdx.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/block/vhdx.c b/block/vhdx.c
index 7ae4589879..9956933da6 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -1008,13 +1008,6 @@ static int vhdx_open(BlockDriverState *bs, QDict *options, int flags,
         goto fail;
     }
 
-    if (flags & BDRV_O_RDWR) {
-        ret = vhdx_update_headers(bs, s, false, NULL);
-        if (ret < 0) {
-            goto fail;
-        }
-    }
-
     /* TODO: differencing files */
 
     return 0;
-- 
2.13.6

  reply	other threads:[~2017-10-30 13:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-30 13:10 [Qemu-devel] [PATCH v2 0/3] Don't write headers if BDS is INACTIVE Jeff Cody
2017-10-30 13:10 ` Jeff Cody [this message]
2017-10-30 13:10 ` [Qemu-devel] [PATCH v2 2/3] block/parallals: Do not update header or truncate image when INMIGRATE Jeff Cody
2017-11-03 11:05   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-11-03 11:08     ` Denis V. Lunev
2017-11-06 20:23       ` Jeff Cody
2017-11-07  2:25         ` Jeff Cody
2017-10-30 13:10 ` [Qemu-devel] [PATCH v2 3/3] qemu-iotests: update unsupported image formats in 194 Jeff Cody
2017-11-02  1:17 ` [Qemu-devel] [PATCH v2 0/3] Don't write headers if BDS is INACTIVE Alexey Kardashevskiy
2017-11-03 10:55 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8d958396d786b6777c71de1a2138e92ef2915649.1509368614.git.jcody@redhat.com \
    --to=jcody@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=den@openvz.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.