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-sta...@nongnu.org
> Signed-off-by: Kevin Wolf <kw...@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 <stefa...@redhat.com>

Reply via email to