[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 01/17] block: stop relying on io_flush() in b
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v3 01/17] block: stop relying on io_flush() in bdrv_drain_all() |
Date: |
Mon, 10 Jun 2013 16:38:42 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Jun 10, 2013 at 02:25:57PM +0200, Stefan Hajnoczi wrote:
> @@ -1427,26 +1456,18 @@ void bdrv_close_all(void)
> void bdrv_drain_all(void)
> {
> BlockDriverState *bs;
> - bool busy;
> -
> - do {
> - busy = qemu_aio_wait();
>
> + while (bdrv_requests_pending_all()) {
> /* FIXME: We do not have timer support here, so this is effectively
> * a busy wait.
> */
> QTAILQ_FOREACH(bs, &bdrv_states, list) {
> if (!qemu_co_queue_empty(&bs->throttled_reqs)) {
> qemu_co_queue_restart_all(&bs->throttled_reqs);
> - busy = true;
> }
> }
> - } while (busy);
>
> - /* If requests are still pending there is a bug somewhere */
> - QTAILQ_FOREACH(bs, &bdrv_states, list) {
> - assert(QLIST_EMPTY(&bs->tracked_requests));
> - assert(qemu_co_queue_empty(&bs->throttled_reqs));
> + qemu_aio_wait();
> }
> }
tests/ide-test found an issue here: block.c invokes callbacks from a BH
so we may not yet have completed the request when this loop terminates.
Kevin: can you fold in this patch?
diff --git a/block.c b/block.c
index 31f7231..e176215 100644
--- a/block.c
+++ b/block.c
@@ -1469,6 +1469,9 @@ void bdrv_drain_all(void)
qemu_aio_wait();
}
+
+ /* Process pending completion BHs */
+ aio_poll(qemu_get_aio_context(), false);
}
/* make a BlockDriverState anonymous by removing from bdrv_state list.
- [Qemu-devel] [PATCH v3 00/17] aio: drop io_flush(), Stefan Hajnoczi, 2013/06/10
- [Qemu-devel] [PATCH v3 03/17] tests: adjust test-aio to new aio_poll() semantics, Stefan Hajnoczi, 2013/06/10
- [Qemu-devel] [PATCH v3 02/17] dataplane/virtio-blk: check exit conditions before aio_poll(), Stefan Hajnoczi, 2013/06/10
- [Qemu-devel] [PATCH v3 05/17] aio: stop using .io_flush(), Stefan Hajnoczi, 2013/06/10
- [Qemu-devel] [PATCH v3 06/17] block/curl: drop curl_aio_flush(), Stefan Hajnoczi, 2013/06/10
- [Qemu-devel] [PATCH v3 07/17] block/gluster: drop qemu_gluster_aio_flush_cb(), Stefan Hajnoczi, 2013/06/10
- [Qemu-devel] [PATCH v3 08/17] block/iscsi: drop iscsi_process_flush(), Stefan Hajnoczi, 2013/06/10
- [Qemu-devel] [PATCH v3 09/17] block/linux-aio: drop qemu_laio_completion_cb(), Stefan Hajnoczi, 2013/06/10
- [Qemu-devel] [PATCH v3 10/17] block/nbd: drop nbd_have_request(), Stefan Hajnoczi, 2013/06/10