diff -Nru qemu-kvm-1.1~rc+dfsg/debian/changelog qemu-kvm-1.1~rc+dfsg/debian/changelog --- qemu-kvm-1.1~rc+dfsg/debian/changelog 2012-08-23 16:18:34.000000000 +0000 +++ qemu-kvm-1.1~rc+dfsg/debian/changelog 2012-08-24 15:20:06.000000000 +0000 @@ -1,3 +1,10 @@ +qemu-kvm (1.1~rc+dfsg-1ubuntu11~ppa1) quantal; urgency=low + + * qcow-preserve-free-byte-offset: attempt fix for qcow2 failures. + (LP: #1040033). + + -- Serge Hallyn Fri, 24 Aug 2012 10:19:27 -0500 + qemu-kvm (1.1~rc+dfsg-1ubuntu10) quantal; urgency=low * debian/qemu-kvm.modprobe: set nested=1 at module load. (LP: #1040230) diff -Nru qemu-kvm-1.1~rc+dfsg/debian/patches/qcow-preserve-free-byte-offset qemu-kvm-1.1~rc+dfsg/debian/patches/qcow-preserve-free-byte-offset --- qemu-kvm-1.1~rc+dfsg/debian/patches/qcow-preserve-free-byte-offset 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.1~rc+dfsg/debian/patches/qcow-preserve-free-byte-offset 2012-08-24 15:19:24.000000000 +0000 @@ -0,0 +1,34 @@ +commit 206e6d8551839008b6858cf8f500d2e644d2b561 +Author: Stefan Hajnoczi +Date: Mon Jun 18 14:00:57 2012 +0100 + + qcow2: preserve free_byte_offset when qcow2_alloc_bytes() fails + + When qcow2_alloc_clusters() error handling code was introduced in commit + 5d757b563d59142ca81e1073a8e8396750a0ad1a, the value of free_byte_offset + was clobbered in the error case. This patch keeps free_byte_offset at 0 + so we will try to allocate clusters again next time this function is + called. + + Signed-off-by: Stefan Hajnoczi + Signed-off-by: Kevin Wolf + +Index: qemu-kvm-1.1~rc+dfsg/block/qcow2-refcount.c +=================================================================== +--- qemu-kvm-1.1~rc+dfsg.orig/block/qcow2-refcount.c 2012-05-31 20:19:22.000000000 -0500 ++++ qemu-kvm-1.1~rc+dfsg/block/qcow2-refcount.c 2012-08-24 10:19:21.481580243 -0500 +@@ -627,10 +627,11 @@ + BLKDBG_EVENT(bs->file, BLKDBG_CLUSTER_ALLOC_BYTES); + assert(size > 0 && size <= s->cluster_size); + if (s->free_byte_offset == 0) { +- s->free_byte_offset = qcow2_alloc_clusters(bs, s->cluster_size); +- if (s->free_byte_offset < 0) { +- return s->free_byte_offset; ++ offset = qcow2_alloc_clusters(bs, s->cluster_size); ++ if (offset < 0) { ++ return offset; + } ++ s->free_byte_offset = offset; + } + redo: + free_in_cluster = s->cluster_size - diff -Nru qemu-kvm-1.1~rc+dfsg/debian/patches/series qemu-kvm-1.1~rc+dfsg/debian/patches/series --- qemu-kvm-1.1~rc+dfsg/debian/patches/series 2012-08-23 16:18:16.000000000 +0000 +++ qemu-kvm-1.1~rc+dfsg/debian/patches/series 2012-08-24 15:19:16.000000000 +0000 @@ -15,3 +15,4 @@ ubuntu/99-ppc-increase-usability-of-ppce500-pci.patch qemu-kvm-Add-missing-default-machine-options.patch qemu-kvm-virtio-Do-not-register-mask-notifiers-witho.patch +qcow-preserve-free-byte-offset