qcow2: Bring synchronous read/write back to lifeqemu-0.11.0-6.fc12qemu-0.11.0-6.fc13
authorKevin Wolf <kwolf@redhat.com>
Thu, 8 Oct 2009 13:02:08 +0000 (15:02 +0200)
committerMark McLoughlin <markmc@redhat.com>
Fri, 9 Oct 2009 14:27:49 +0000 (15:27 +0100)
commit1df18d4a961a66b9ea28ab83b409f4d9d470f148
tree8f1b05a2e35c83b61478448eabd813b042cbcf49
parent565c62123258970d9254bc7b8eaa8f4c66ab2a21
qcow2: Bring synchronous read/write back to life

When the synchronous read and write functions were dropped, they were replaced
by generic emulation functions. Unfortunately, these emulation functions don't
provide the same semantics as the original functions did.

The original bdrv_read would mean that we read some data synchronously and that
we won't be interrupted during this read. The latter assumption is no longer
true with the emulation function which needs to use qemu_aio_poll and therefore
allows the callback of any other concurrent AIO request to be run during the
read. Which in turn means that (meta)data read earlier could have changed and
be invalid now. qcow2 is not prepared to work in this way and it's just scary
how many places there are where other requests could run.

I'm not sure yet where exactly it breaks, but you'll see breakage with virtio
on qcow2 with a backing file. Providing synchronous functions again fixes the
problem for me.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Fedora-patch: qemu-fix-qcow2-backing-file-with-virtio.patch
block/qcow2-cluster.c
block/qcow2.c
block/qcow2.h