[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 12/13] vl: Drain before (block) job cancel when quitt
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 12/13] vl: Drain before (block) job cancel when quitting |
Date: |
Fri, 19 Jul 2019 15:43:44 +0200 |
From: Max Reitz <address@hidden>
If the main loop cancels all block jobs while the block layer is not
drained, this cancelling may not happen instantaneously. We can start a
drained section before vm_shutdown(), which entails another
bdrv_drain_all(); this nested bdrv_drain_all() will thus be a no-op,
basically.
We do not have to end the drained section, because we actually do not
want any requests to happen from this point on.
Signed-off-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
vl.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/vl.c b/vl.c
index a5808f9a02..53335a5470 100644
--- a/vl.c
+++ b/vl.c
@@ -4480,6 +4480,17 @@ int main(int argc, char **argv, char **envp)
*/
migration_shutdown();
+ /*
+ * We must cancel all block jobs while the block layer is drained,
+ * or cancelling will be affected by throttling and thus may block
+ * for an extended period of time.
+ * vm_shutdown() will bdrv_drain_all(), so we may as well include
+ * it in the drained section.
+ * We do not need to end this section, because we do not want any
+ * requests happening from here on anyway.
+ */
+ bdrv_drain_all_begin();
+
/* No more vcpu or device emulation activity beyond this point */
vm_shutdown();
--
2.20.1
[Qemu-devel] [PULL 09/13] block: Loop unsafely in bdrv*drained_end(), Kevin Wolf, 2019/07/19
[Qemu-devel] [PULL 07/13] block: Do not poll in bdrv_do_drained_end(), Kevin Wolf, 2019/07/19
[Qemu-devel] [PULL 08/13] tests: Extend commit by drained_end test, Kevin Wolf, 2019/07/19
[Qemu-devel] [PULL 12/13] vl: Drain before (block) job cancel when quitting,
Kevin Wolf <=
[Qemu-devel] [PULL 10/13] iotests: Add @has_quit to vm.shutdown(), Kevin Wolf, 2019/07/19
[Qemu-devel] [PULL 11/13] iotests: Test commit with a filter on the chain, Kevin Wolf, 2019/07/19
[Qemu-devel] [PULL 13/13] iotests: Test quitting with job on throttled node, Kevin Wolf, 2019/07/19
Re: [Qemu-devel] [PULL 00/13] Block layer patches, Peter Maydell, 2019/07/22