qemu-e2k/block
Paolo Bonzini c9d1a56174 block: only call aio_poll on the current thread's AioContext
aio_poll is not thread safe; for example bdrv_drain can hang if
the last in-flight I/O operation is completed in the I/O thread after
the main thread has checked bs->in_flight.

The bug remains latent as long as all of it is called within
aio_context_acquire/aio_context_release, but this will change soon.

To fix this, if bdrv_drain is called from outside the I/O thread,
signal the main AioContext through a dummy bottom half.  The event
loop then only runs in the I/O thread.

Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1477565348-5458-18-git-send-email-pbonzini@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
2016-10-28 21:50:18 +08:00
..
accounting.c
archipelago.c block: use aio_bh_schedule_oneshot 2016-10-07 13:34:07 +02:00
backup.c blockjob: introduce .drain callback for jobs 2016-10-28 21:50:18 +08:00
blkdebug.c block: use aio_bh_schedule_oneshot 2016-10-07 13:34:07 +02:00
blkreplay.c replay: allow replay stopping and restarting 2016-09-27 11:57:30 +02:00
blkverify.c block: use aio_bh_schedule_oneshot 2016-10-07 13:34:07 +02:00
block-backend.c block: introduce BDRV_POLL_WHILE 2016-10-28 21:50:18 +08:00
bochs.c
cloop.c
commit.c block: prepare bdrv_reopen_multiple to release AioContext 2016-10-28 21:50:18 +08:00
crypto.c crypto: make PBKDF iterations configurable for LUKS format 2016-09-19 16:30:45 +01:00
curl.c block: use aio_bh_schedule_oneshot 2016-10-07 13:34:07 +02:00
dirty-bitmap.c block: More operations for meta dirty bitmap 2016-10-24 17:56:07 +02:00
dmg-bz2.c dmg: Move libbz2 code to dmg-bz2.so 2016-10-07 14:14:06 +02:00
dmg.c dmg: Move libbz2 code to dmg-bz2.so 2016-10-07 14:14:06 +02:00
dmg.h dmg: Move libbz2 code to dmg-bz2.so 2016-10-07 14:14:06 +02:00
gluster.c block: use aio_bh_schedule_oneshot 2016-10-07 13:34:07 +02:00
io.c block: only call aio_poll on the current thread's AioContext 2016-10-28 21:50:18 +08:00
iscsi.c block/iscsi: Adding new iSER transport layer option 2016-10-24 11:30:55 +02:00
linux-aio.c linux-aio: fix re-entrant completion processing 2016-09-28 17:11:23 +01:00
Makefile.objs dmg: Move libbz2 code to dmg-bz2.so 2016-10-07 14:14:06 +02:00
mirror.c mirror: use bdrv_drained_begin/bdrv_drained_end 2016-10-28 21:50:18 +08:00
nbd-client.c
nbd-client.h
nbd.c block/nbd: Use SocketAddress options 2016-10-27 19:05:23 +02:00
nfs.c block: only call aio_poll on the current thread's AioContext 2016-10-28 21:50:18 +08:00
null.c block: use aio_bh_schedule_oneshot 2016-10-07 13:34:07 +02:00
parallels.c
qapi.c qapi: rename QmpOutputVisitor to QObjectOutputVisitor 2016-10-25 16:25:54 +02:00
qcow2-cache.c
qcow2-cluster.c qcow2: Support BDRV_REQ_MAY_UNMAP 2016-10-24 17:54:03 +02:00
qcow2-refcount.c
qcow2-snapshot.c
qcow2.c qcow2: Support BDRV_REQ_MAY_UNMAP 2016-10-24 17:54:03 +02:00
qcow2.h qcow2: Support BDRV_REQ_MAY_UNMAP 2016-10-24 17:54:03 +02:00
qcow.c crypto: extend mode as a parameter in qcrypto_cipher_supports() 2016-10-19 10:09:24 +01:00
qed-check.c
qed-cluster.c
qed-gencb.c
qed-l2-cache.c
qed-table.c block: introduce BDRV_POLL_WHILE 2016-10-28 21:50:18 +08:00
qed.c qed: Implement .bdrv_drain 2016-10-28 21:50:18 +08:00
qed.h block: use aio_bh_schedule_oneshot 2016-10-07 13:34:07 +02:00
quorum.c quorum: do not allocate multiple iovecs for FIFO strategy 2016-10-24 17:56:06 +02:00
raw_bsd.c raw: Implement .bdrv_co_ioctl instead of .bdrv_aio_ioctl 2016-10-27 19:05:23 +02:00
raw-posix.c raw-posix: Don't use bdrv_ioctl() 2016-10-27 19:05:23 +02:00
raw-win32.c block: improve error handling in raw_open 2016-10-24 17:54:03 +02:00
rbd.c rbd: shift byte count as a 64-bit value 2016-10-23 16:10:59 +02:00
replication.c block: prepare bdrv_reopen_multiple to release AioContext 2016-10-28 21:50:18 +08:00
sheepdog.c block: only call aio_poll on the current thread's AioContext 2016-10-28 21:50:18 +08:00
snapshot.c
ssh.c
stream.c
throttle-groups.c throttle: Correct access to wrong BlockBackendPublic structures 2016-10-24 17:54:03 +02:00
trace-events block: Remove bdrv_aio_pdiscard() 2016-10-27 19:05:22 +02:00
vdi.c vdi: Use QEMU UUID API 2016-09-23 11:42:52 +08:00
vhdx-endian.c vhdx: Use QEMU UUID API 2016-09-23 11:42:52 +08:00
vhdx-log.c
vhdx.c vhdx: Use QEMU UUID API 2016-09-23 11:42:52 +08:00
vhdx.h
vmdk.c
vpc.c vpc: Use QEMU UUID API 2016-09-23 11:42:52 +08:00
vvfat.c block: Add "read-only" to the options QDict 2016-09-23 13:36:10 +02:00
win32-aio.c
write-threshold.c block: use bdrv_add_before_write_notifier 2016-10-07 13:34:07 +02:00