[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] qcow2: Flush metadata during read-only reopen
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH] qcow2: Flush metadata during read-only reopen |
Date: |
Fri, 4 Apr 2014 10:19:51 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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: address@hidden
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> 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 <address@hidden>