qcow2: Bring synchronous read/write back to life
commitef845c3bf421290153154635dc18eaa677cecb43
authorKevin Wolf <kwolf@redhat.com>
Thu, 8 Oct 2009 13:02:08 +0000 (8 15:02 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Thu, 15 Oct 2009 14:32:04 +0000 (15 09:32 -0500)
treeba19ca2a96584e32e0fa08bcbea93ea46232507e
parentbe8b28a94020fd564c9bb9f0094e8c3ff45c0771
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.

Patchworks-ID: 35437
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
block/qcow2-cluster.c
block/qcow2.c
block/qcow2.h