Skip to contentSkip to conversation

kvm tools, qcow: Fix copy-on-write image corruption

tip:tools/kvm Kevin Wolf 2 participants 3 messages Jul 21, 2011 – Jul 22, 2011 1 message not in the archive KVM

lore
Share & tools
lore

Kevin Wolf

author
#1 lore raw
In reply to a message not in the archive

Am 20.07.2011 21:49, schrieb tip-bot for Pekka Enberg:

Quoted 7 lines
Commit-ID:  4839bcd6b04a1b628f0f00d535ddca2ee872e9fa
Gitweb:     http://git.kernel.org/tip/4839bcd6b04a1b628f0f00d535ddca2ee872e9fa
Author:     Pekka Enberg <[email protected]>
AuthorDate: Wed, 20 Jul 2011 16:28:31 +0300
Committer:  Pekka Enberg <[email protected]>
CommitDate: Wed, 20 Jul 2011 16:28:31 +0300
Quoted 8 lines

kvm tools, qcow: Fix copy-on-write image corruption

We don't handle refcount table properly so make sure we only write to clusters that have the "copied" flag set.

Cc Kevin Wolf <[email protected]>
Cc Sasha Levin <[email protected]>

Hm, I must have missed this patch on the KVM mailing list...

You should also error out before creating a new L2 table as its refcount would have to be updated, too. On the other hand, the patch is a bit too restrictive, because it applies the check to qcow1 which doesn't even have a refcount table.

I'm not sure if everyone is aware of it, so another hint: Now that you can't grow qcow2 any more, you might find it useful to use qemu-img create -f qcow2 -o preallocation=metadata, so that all clusters are already present and you don't get random failures.

Kevin

#2 lore raw
Quoted 1 line · Kevin Wolf

Hm, I must have missed this patch on the KVM mailing list...

It wasn't on the list, sorry.

Quoted 4 lines

You should also error out before creating a new L2 table as its refcount would have to be updated, too. On the other hand, the patch is a bit too restrictive, because it applies the check to qcow1 which doesn't even have a refcount table.

Oh, right, I broken QCOW1.

Quoted 4 lines

I'm not sure if everyone is aware of it, so another hint: Now that you can't grow qcow2 any more, you might find it useful to use qemu-img create -f qcow2 -o preallocation=metadata, so that all clusters are already present and you don't get random failures.

Yup, I'm aware that you can't grow images anymore. The patch was meant as a stop-gap measure while I'm hacking on refcount table support.

Pekka

author
#3 lore raw

Am 22.07.2011 10:21, schrieb Pekka Enberg:

Quoted 12 lines · Kevin Wolf
Quoted 1 line

Hm, I must have missed this patch on the KVM mailing list...

It wasn't on the list, sorry.

Quoted 4 lines

You should also error out before creating a new L2 table as its refcount would have to be updated, too. On the other hand, the patch is a bit too restrictive, because it applies the check to qcow1 which doesn't even have a refcount table.

Oh, right, I broken QCOW1.

Quoted 7 lines
Quoted 4 lines

I'm not sure if everyone is aware of it, so another hint: Now that you can't grow qcow2 any more, you might find it useful to use qemu-img create -f qcow2 -o preallocation=metadata, so that all clusters are already present and you don't get random failures.

Yup, I'm aware that you can't grow images anymore. The patch was meant as a stop-gap measure while I'm hacking on refcount table support.

Yeah, I was pretty sure you were aware of _that_, but maybe not everyone knows that metadata preallocation exists.

Kevin