qemu-e2k/block
Paolo Bonzini 848c66e8f5 block: add a CoMutex to synchronous read drivers
The big conversion of bdrv_read/write to coroutines caused the two
homonymous callbacks in BlockDriver to become reentrant.  It goes
like this:

1) bdrv_read is now called in a coroutine, and calls bdrv_read or
bdrv_pread.

2) the nested bdrv_read goes through the fast path in bdrv_rw_co_entry;

3) in the common case when the protocol is file, bdrv_co_do_readv calls
bdrv_co_readv_em (and from here goes to bdrv_co_io_em), which yields
until the AIO operation is complete;

4) if bdrv_read had been called from a bottom half, the main loop
is free to iterate again: a device model or another bottom half
can then come and call bdrv_read again.

This applies to all four of read/write/flush/discard.  It would also
apply to is_allocated, but it is not used from within coroutines:
besides qemu-img.c and qemu-io.c, which operate synchronously, the
only user is the monitor.  Copy-on-read will introduce a use in the
block layer, and will require converting it.

The solution is "simply" to convert all drivers to coroutines!  We
just need to add a CoMutex that is taken around affected operations.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-21 17:34:13 +02:00
..
blkdebug.c block: drop redundant bdrv_flush implementation 2011-10-21 17:34:13 +02:00
blkverify.c block: drop redundant bdrv_flush implementation 2011-10-21 17:34:13 +02:00
bochs.c block: add a CoMutex to synchronous read drivers 2011-10-21 17:34:13 +02:00
cloop.c block: add a CoMutex to synchronous read drivers 2011-10-21 17:34:13 +02:00
cow.c block: add a CoMutex to synchronous read drivers 2011-10-21 17:34:13 +02:00
curl.c block/curl: Don't finish AIOCBs too early 2011-09-21 15:16:04 +02:00
dmg.c block: add a CoMutex to synchronous read drivers 2011-10-21 17:34:13 +02:00
nbd.c block: add a CoMutex to synchronous read drivers 2011-10-21 17:34:13 +02:00
parallels.c block: add a CoMutex to synchronous read drivers 2011-10-21 17:34:13 +02:00
qcow.c block: drop redundant bdrv_flush implementation 2011-10-21 17:34:13 +02:00
qcow2-cache.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qcow2-cluster.c qcow2: Fix bdrv_write_compressed error handling 2011-10-21 17:34:13 +02:00
qcow2-refcount.c qcow2: remove unused qcow2_create_refcount_update function 2011-08-25 15:23:10 +02:00
qcow2-snapshot.c Use new macro QEMU_PACKED for packed structures 2011-09-03 10:45:59 +00:00
qcow2.c qcow2: Fix bdrv_write_compressed error handling 2011-10-21 17:34:13 +02:00
qcow2.h qcow2: removed unused depends_on field 2011-09-12 15:17:17 +02:00
qed-check.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qed-cluster.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qed-gencb.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qed-l2-cache.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qed-table.c qed: fix use-after-free during l2 cache commit 2011-10-05 10:52:31 -05:00
qed.c block: drop redundant bdrv_flush implementation 2011-10-21 17:34:13 +02:00
qed.h qed: Periodically flush and clear need check bit 2011-05-18 14:38:46 +02:00
raw-posix-aio.h Remove aio_ctx from paio_* interface 2009-10-30 08:39:34 -05:00
raw-posix.c block: drop redundant bdrv_flush implementation 2011-10-21 17:34:13 +02:00
raw-win32.c w32: Fix qemu_ftruncate64 2011-08-22 10:19:00 -05:00
raw.c block: add bdrv_co_discard and bdrv_aio_discard support 2011-10-21 17:34:13 +02:00
rbd.c rbd: allow escaping in config string 2011-09-20 14:34:17 +02:00
sheepdog.c sheepdog: add coroutine_fn markers 2011-10-21 17:34:12 +02:00
vdi.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
vmdk.c block: add a CoMutex to synchronous read drivers 2011-10-21 17:34:13 +02:00
vpc.c block: add a CoMutex to synchronous read drivers 2011-10-21 17:34:13 +02:00
vvfat.c block: add a CoMutex to synchronous read drivers 2011-10-21 17:34:13 +02:00