qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qcow2: Flush metadata during read-only reopen
Date: Fri, 4 Apr 2014 10:19:51 +0200	[thread overview]
Message-ID: <20140404081951.GC9801@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1396532792-6399-1-git-send-email-kwolf@redhat.com>

On Thu, Apr 03, 2014 at 03:46:32PM +0200, Kevin Wolf wrote:
> If lazy refcounts are enabled for a backing file, committing to this
> backing file may leave it in a dirty state even if the commit succeeds.
> The reason is that the bdrv_flush() call in bdrv_commit() doesn't flush
> refcount updates with lazy refcounts enabled, and qcow2_reopen_prepare()
> doesn't take care to flush metadata.
> 
> In order to fix this, this patch also fixes qcow2_mark_clean(), which
> contains another ineffective bdrv_flush() call beause lazy refcounts are
> disabled only afterwards. All existing callers of qcow2_mark_clean()
> either don't modify refcounts or already flush manually, so that this
> fixes only a latent, but not yet actually triggerable bug.
> 
> Another instance of the same problem is live snapshots. Again, a real
> corruption is prevented by an explicit flush for non-read-only images in
> external_snapshot_prepare(), but images using lazy refcounts stay dirty.
> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/qcow2.c              | 25 +++++++++++++++++++++----
>  tests/qemu-iotests/039     | 20 ++++++++++++++++++++
>  tests/qemu-iotests/039.out | 11 +++++++++++
>  3 files changed, 52 insertions(+), 4 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

      reply	other threads:[~2014-04-04  8:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-03 13:46 [Qemu-devel] [PATCH] qcow2: Flush metadata during read-only reopen Kevin Wolf
2014-04-04  8:19 ` Stefan Hajnoczi [this message]

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=20140404081951.GC9801@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).