All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Philipp Hahn <hahn@univention.de>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org,
	Stefan Gohmann <gohmann@univention.de>
Subject: Re: [BUG] Qcow2 corruption on snapshot revert
Date: Thu, 04 Aug 2011 16:57:24 +0200	[thread overview]
Message-ID: <4E3AB354.4080903@redhat.com> (raw)
In-Reply-To: <201108041620.13687.hahn@univention.de>

Am 04.08.2011 16:20, schrieb Philipp Hahn:
> Hello,
> 
> it seems like I have discovered a bug in qemu-0.14.1 which corrupts Qcow2 
> image files when using internal snapshots.
> I tied this both on an amd64 host running our Debian bases UCS distribution 
> (using pure qemu-kvm_0.14 and pure qemu-kvm_0.14.1) and also on a pure Debian 
> i386 sid installation (patched qemu-kvm_0.14.1).
> I can reproducte this every time doing the following steps:
> 0. Create and install VM
> 1. Shut down VM
> 2. Create offline snapshot using "qemu-img snapshot -c Off image.qcow2"
> 3. Start VM
> 4. Create online snapshot using "savevm On"
> 5. Shut down VM
> 6. Revert to snapshot using "qemu-img snapshot -a Off image.qcow2"
> Repeat step 6 three or more times and the Image is destroyed.
> 
> My guess is that this is a but in qemu-img, which is related to having an 
> online snapshot (VM running) while reverting to an offline snapshot (VM 
> stopped), because I wasn't able to reproduce this using only offline 
> snapshots or only online snapshots.
> 
> I have attached a shell script to reproduce this bug on all my runs.
> * It both happens with kvm-0.14.1 and also with qemu-0.14.1.
> * The cache stragtegy "writethrough" vs. "writeback" is irrelevant.
> 
> The script needs an image nameded "pmh_squeeze-0.qcow.bak2" of an VM where you 
> can login via serial console using "root" for login and "univention" for 
> password. You can use other images as well, as long as you modify the block 
> device from within the VM. You get get it from 
> <http://download.univention.de/download/temp/qemu-0.14-qcow2/>
> 
> There you will also find the beginning of a small Python program 
> called "qcow2.py" which can be used to dump the structure of an qcow2 file in 
> some more human readable format with some consistency checking.
> 
> Related links:
> <http://git.kernel.org/?p=virt/kvm/qemu-kvm.git;a=commit;h=e11480db7ff15a9e878f6b3cc1199b439bf7c825>
> <http://git.kernel.org/?p=virt/kvm/qemu-kvm.git;a=commit;h=f0aa7a8b2d518c54430e4382309281b93e51981a>
> <http://lists.gnu.org/archive/html/qemu-devel/2011-04/msg01376.html>
> <https://forge.univention.org/bugzilla/show_bug.cgi?id=22221>
> 
> Any help is appreciated.

Thanks for the report. This small script seems to be enough to reproduce
the corruption:

qemu-img create -f qcow2 /tmp/sn.qcow2 64M
qemu-img snapshot -c foo /tmp/sn.qcow2
qemu-io -c 'write -b 0 4M' /tmp/sn.qcow2
qemu-img snapshot -a foo /tmp/sn.qcow2

I'll look into the details tomorrow.

Kevin

WARNING: multiple messages have this Message-ID (diff)
From: Kevin Wolf <kwolf@redhat.com>
To: Philipp Hahn <hahn@univention.de>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org,
	Stefan Gohmann <gohmann@univention.de>
Subject: Re: [Qemu-devel] [BUG] Qcow2 corruption on snapshot revert
Date: Thu, 04 Aug 2011 16:57:24 +0200	[thread overview]
Message-ID: <4E3AB354.4080903@redhat.com> (raw)
In-Reply-To: <201108041620.13687.hahn@univention.de>

Am 04.08.2011 16:20, schrieb Philipp Hahn:
> Hello,
> 
> it seems like I have discovered a bug in qemu-0.14.1 which corrupts Qcow2 
> image files when using internal snapshots.
> I tied this both on an amd64 host running our Debian bases UCS distribution 
> (using pure qemu-kvm_0.14 and pure qemu-kvm_0.14.1) and also on a pure Debian 
> i386 sid installation (patched qemu-kvm_0.14.1).
> I can reproducte this every time doing the following steps:
> 0. Create and install VM
> 1. Shut down VM
> 2. Create offline snapshot using "qemu-img snapshot -c Off image.qcow2"
> 3. Start VM
> 4. Create online snapshot using "savevm On"
> 5. Shut down VM
> 6. Revert to snapshot using "qemu-img snapshot -a Off image.qcow2"
> Repeat step 6 three or more times and the Image is destroyed.
> 
> My guess is that this is a but in qemu-img, which is related to having an 
> online snapshot (VM running) while reverting to an offline snapshot (VM 
> stopped), because I wasn't able to reproduce this using only offline 
> snapshots or only online snapshots.
> 
> I have attached a shell script to reproduce this bug on all my runs.
> * It both happens with kvm-0.14.1 and also with qemu-0.14.1.
> * The cache stragtegy "writethrough" vs. "writeback" is irrelevant.
> 
> The script needs an image nameded "pmh_squeeze-0.qcow.bak2" of an VM where you 
> can login via serial console using "root" for login and "univention" for 
> password. You can use other images as well, as long as you modify the block 
> device from within the VM. You get get it from 
> <http://download.univention.de/download/temp/qemu-0.14-qcow2/>
> 
> There you will also find the beginning of a small Python program 
> called "qcow2.py" which can be used to dump the structure of an qcow2 file in 
> some more human readable format with some consistency checking.
> 
> Related links:
> <http://git.kernel.org/?p=virt/kvm/qemu-kvm.git;a=commit;h=e11480db7ff15a9e878f6b3cc1199b439bf7c825>
> <http://git.kernel.org/?p=virt/kvm/qemu-kvm.git;a=commit;h=f0aa7a8b2d518c54430e4382309281b93e51981a>
> <http://lists.gnu.org/archive/html/qemu-devel/2011-04/msg01376.html>
> <https://forge.univention.org/bugzilla/show_bug.cgi?id=22221>
> 
> Any help is appreciated.

Thanks for the report. This small script seems to be enough to reproduce
the corruption:

qemu-img create -f qcow2 /tmp/sn.qcow2 64M
qemu-img snapshot -c foo /tmp/sn.qcow2
qemu-io -c 'write -b 0 4M' /tmp/sn.qcow2
qemu-img snapshot -a foo /tmp/sn.qcow2

I'll look into the details tomorrow.

Kevin

  reply	other threads:[~2011-08-04 14:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-04 14:20 [BUG] Qcow2 corruption on snapshot revert Philipp Hahn
2011-08-04 14:20 ` [Qemu-devel] " Philipp Hahn
2011-08-04 14:57 ` Kevin Wolf [this message]
2011-08-04 14:57   ` Kevin Wolf

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=4E3AB354.4080903@redhat.com \
    --to=kwolf@redhat.com \
    --cc=gohmann@univention.de \
    --cc=hahn@univention.de \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@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 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.