|
From: | Avi Kivity |
Subject: | Re: [Qemu-devel] Strange virtio regression on mainline and stable-0.10 |
Date: | Wed, 06 May 2009 11:34:43 +0300 |
User-agent: | Thunderbird 2.0.0.21 (X11/20090320) |
Kevin Wolf wrote:
Avi Kivity schrieb:Avi Kivity wrote:Running the Fedora 10 installer on a virtio disk on current master and on v0.10.3 will cause the installer to complain when mounting the freshly formatted filesystems.The problem is that qcow2 does a read-modify-write on non-cluster-aligned writes. So the following sequence triggers the bug:[...]This could be solved by maintaining a hash table of refcounted RMW copies for the disk. When reading for a RMW, look up the hash table, if there's a copy there, use it instead of reading it yourself.We should also avoid the RMW for non-compressed, non-encrypted clusters, as virtually ALL writes will be misaligned.I don't think there is a RMW except for the COW case which is unavoidable and obviously happens only once for each cluster. Do you see any other places where this happens?
No, I misread the code. I think the real problem is two parallel writes for the same cluster (but different sectors) started concurrently, so get_cluster_offset() places them in different clusters. When the second write completes we get unexpected results since the metadata now contains a block where on the start of the operation it was unallocated.
We could probably get away with serializing only writes that hit the same cluster. A better approach may be to try to place parallel sequential writes contiguously in the allocating case.
-- Do not meddle in the internals of kernels, for they are subtle and quick to panic.
[Prev in Thread] | Current Thread | [Next in Thread] |