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
..
2016-10-17 14:13:58 +02:00
2016-10-04 13:28:07 +01:00
2016-10-25 10:25:27 +01:00
2016-10-10 16:23:40 +01:00
2016-10-24 15:46:10 +02:00
2016-06-17 16:33:48 +10:00
2016-06-14 15:59:13 +01:00
2016-10-24 17:29:15 -02:00
2016-10-04 14:25:08 +01:00
2016-05-18 15:04:27 +03:00
2016-10-24 15:27:20 +02:00
2016-09-23 11:42:52 +08:00
2016-07-29 00:07:09 +03:00
2016-01-29 15:07:25 +00:00
2016-09-22 18:13:08 +01:00
2016-09-15 15:32:22 +03:00
2016-09-29 11:43:22 +08:00
2016-09-15 15:32:22 +03:00
2016-10-24 15:03:09 +01:00
2016-10-17 10:58:03 -06:00
2016-10-24 15:27:20 +02:00
2016-10-04 13:28:07 +01:00