[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/71] virtio-blk: Increase in_flight for request res
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 10/71] virtio-blk: Increase in_flight for request restart BH |
Date: |
Mon, 25 Feb 2019 16:19:52 +0100 |
virtio_blk_dma_restart_bh() submits new requests, so in order to make
sure that these requests are not started inside a drained section of the
attached BlockBackend, we need to make sure that draining the
BlockBackend waits for the BH to be executed.
This BH is still questionable because its scheduled in the main thread
instead of the configured iothread. Leave a FIXME comment for this.
But with this fix, enabling the data plane at least waits for these
requests (in bdrv_set_aio_context()) instead of changing the AioContext
under their feet and making them run in the wrong thread, causing
crashes and failures (e.g. due to missing locking).
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/block/virtio-blk.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index cf7f47eaba..e11e6e45d0 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -675,6 +675,7 @@ static void virtio_blk_dma_restart_bh(void *opaque)
if (mrb.num_reqs) {
virtio_blk_submit_multireq(s->blk, &mrb);
}
+ blk_dec_in_flight(s->conf.conf.blk);
aio_context_release(blk_get_aio_context(s->conf.conf.blk));
}
@@ -688,8 +689,11 @@ static void virtio_blk_dma_restart_cb(void *opaque, int
running,
}
if (!s->bh) {
+ /* FIXME The data plane is not started yet, so these requests are
+ * processed in the main thread. */
s->bh = aio_bh_new(blk_get_aio_context(s->conf.conf.blk),
virtio_blk_dma_restart_bh, s);
+ blk_inc_in_flight(s->conf.conf.blk);
qemu_bh_schedule(s->bh);
}
}
--
2.20.1
- [Qemu-devel] [PULL 00/71] Block layer patches, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 01/71] MAINTAINERS: Replace myself with John Snow for block jobs, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 02/71] MAINTAINERS: Remove myself as block maintainer, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 04/71] block/snapshot: remove bdrv_snapshot_delete_by_id_or_name, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 05/71] qcow2-snapshot: remove redundant find_snapshot_by_id_and_name call, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 03/71] block/snapshot.c: eliminate use of ID input in snapshot operations, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 07/71] commit: Replace commit_top_bs on failure after deleting the block job, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 06/71] block: don't set the same context, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 09/71] block-backend: Make blk_inc/dec_in_flight public, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 08/71] qemu-img: fix error reporting for -object, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 10/71] virtio-blk: Increase in_flight for request restart BH,
Kevin Wolf <=
- [Qemu-devel] [PULL 11/71] nbd: Restrict connection_co reentrance, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 12/71] io: Make qio_channel_yield() interruptible, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 14/71] nbd: Move nbd_read_eof() to nbd/client.c, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 18/71] block: Fix AioContext switch for drained node, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 13/71] io: Remove redundant read/write_coroutine assignments, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 16/71] nbd: Increase bs->in_flight during AioContext switch, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 20/71] block: Use normal drain for bdrv_set_aio_context(), Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 19/71] test-bdrv-drain: AioContext switch in drained section, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 15/71] nbd: Use low-level QIOChannel API in nbd_read_eof(), Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 17/71] block: Don't poll in bdrv_set_aio_context(), Kevin Wolf, 2019/02/25