From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPxW9-0004Bm-DX for qemu-devel@nongnu.org; Fri, 05 Sep 2014 13:41:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPxW2-0008AQ-HT for qemu-devel@nongnu.org; Fri, 05 Sep 2014 13:41:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPxW2-0008AL-Aa for qemu-devel@nongnu.org; Fri, 05 Sep 2014 13:41:42 -0400 Date: Fri, 5 Sep 2014 18:41:37 +0100 From: "Richard W.M. Jones" Message-ID: <20140905174137.GI1302@redhat.com> References: <20140830145313.GN14001@redhat.com> <20140905153951.GJ27649@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="PqX6tBBuHl4HmZHK" Content-Disposition: inline In-Reply-To: <20140905153951.GJ27649@stefanha-thinkpad.redhat.com> Subject: Re: [Qemu-devel] qcow2, lazy_refcounts and killing qemu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: kwolf@redhat.com, qemu-devel@nongnu.org --PqX6tBBuHl4HmZHK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Sep 05, 2014 at 04:39:51PM +0100, Stefan Hajnoczi wrote: > Did you try older QEMU versions? I'm curious if this is something that > crept in later or is fundamentally broken in lazy_refcounts=on. At your prompting, I've done a bit more investigation. I was basing my observations on qemu 2.1.0. However I tried my test against qemu from git today and the bug has gone. Good! For my entertainment, I bisected the problem, and the commit which *fixes* it is: commit 91af7014125895cc74141be6b60f3a3e882ed743 Author: Max Reitz Date: Fri Jul 18 20:24:56 2014 +0200 block: Add bdrv_refresh_filename() I didn't believe this either, but I have checked the result manually and I'm pretty sure that whatever this commit does, it does end up fixing the lazy_refcounts problem as a side-effect. ---------------------------------------------------------------------- I've updated the test script (attached), so you can now run it against your own qemu, and also to improve the output. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/ --PqX6tBBuHl4HmZHK Content-Type: application/x-sh Content-Disposition: attachment; filename="qemu-lazy-refcounts.sh" Content-Transfer-Encoding: quoted-printable #!/bin/bash -=0A=0A# Try turning lazy_refcounts on or off here.=0Aoptions= =3D'compat=3D1.1,backing_fmt=3Draw,lazy_refcounts=3Don'=0A#options=3D'compa= t=3D1.1,backing_fmt=3Draw'=0A=0A# Try using direct qemu or via libvirt or d= istro default.=0A#export LIBGUESTFS_BACKEND=3Ddirect=0A#export LIBGUESTFS_B= ACKEND=3Dlibvirt=0A=0A# Use local qemu.=0A#export LIBGUESTFS_HV=3D/home/rjo= nes/d/qemu/x86_64-softmmu/qemu-system-x86_64=0A#export PATH=3D/home/rjones/= d/qemu:$PATH=0A=0Acd /tmp=0Arm -f test1.img=0Akillall qemu-nbd=0A=0Aset -x= =0Aset -e=0A=0A# Create test filesystem (test1.img).=0Aguestfish -N fs exit= =0A=0A# Serve it over nbd.=0Aqemu-nbd -r -t -f raw test1.img &=0Asleep 2=0A= =0A# Create overlay.=0Aqemu-img create -f qcow2 -b nbd:localhost:10809 -o $= options overlay.qcow2=0A=0A# Write stuff to the overlay.=0Aguestfish < /tmp/qemu-info.txt=0A=0Aif grep -q backing /tmp= /qemu-info.txt; then=0A echo "GOOD: qemu is OK"=0Aelse=0A echo "BAD: = qemu lost backing file"=0Afi=0A=0Akillall qemu-nbd=0A --PqX6tBBuHl4HmZHK--