thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
Pablo Greco e6a3ae
From ee7b9d7867634d052f2c695fcebf68f585fe59c0 Mon Sep 17 00:00:00 2001
Pablo Greco e6a3ae
From: Kevin Wolf <kwolf@redhat.com>
Pablo Greco e6a3ae
Date: Wed, 14 Aug 2019 08:42:27 +0100
Pablo Greco e6a3ae
Subject: [PATCH 04/10] block: Fix AioContext switch for drained node
Pablo Greco e6a3ae
Pablo Greco e6a3ae
RH-Author: Kevin Wolf <kwolf@redhat.com>
Pablo Greco e6a3ae
Message-id: <20190814084229.6458-4-kwolf@redhat.com>
Pablo Greco e6a3ae
Patchwork-id: 89969
Pablo Greco e6a3ae
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH 3/5] block: Fix AioContext switch for drained node
Pablo Greco e6a3ae
Bugzilla: 1716349
Pablo Greco e6a3ae
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Max Reitz <mreitz@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
When a drained node changes its AioContext, we need to move its
Pablo Greco e6a3ae
aio_disable_external() to the new context, too.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Without this fix, drain_end will try to reenable the new context, which
Pablo Greco e6a3ae
has never been disabled, so an assertion failure is triggered.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Pablo Greco e6a3ae
Reviewed-by: Eric Blake <eblake@redhat.com>
Pablo Greco e6a3ae
(cherry picked from commit e64f25f30b80a71bd4e409ed518c39eeb5905166)
Pablo Greco e6a3ae
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
---
Pablo Greco e6a3ae
 block.c | 7 +++++++
Pablo Greco e6a3ae
 1 file changed, 7 insertions(+)
Pablo Greco e6a3ae
Pablo Greco e6a3ae
diff --git a/block.c b/block.c
Pablo Greco e6a3ae
index 82b16df..9d9b8a9 100644
Pablo Greco e6a3ae
--- a/block.c
Pablo Greco e6a3ae
+++ b/block.c
Pablo Greco e6a3ae
@@ -4948,6 +4948,9 @@ void bdrv_detach_aio_context(BlockDriverState *bs)
Pablo Greco e6a3ae
         bdrv_detach_aio_context(child->bs);
Pablo Greco e6a3ae
     }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
+    if (bs->quiesce_counter) {
Pablo Greco e6a3ae
+        aio_enable_external(bs->aio_context);
Pablo Greco e6a3ae
+    }
Pablo Greco e6a3ae
     bs->aio_context = NULL;
Pablo Greco e6a3ae
 }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
@@ -4961,6 +4964,10 @@ void bdrv_attach_aio_context(BlockDriverState *bs,
Pablo Greco e6a3ae
         return;
Pablo Greco e6a3ae
     }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
+    if (bs->quiesce_counter) {
Pablo Greco e6a3ae
+        aio_disable_external(new_context);
Pablo Greco e6a3ae
+    }
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
     bs->aio_context = new_context;
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
     QLIST_FOREACH(child, &bs->children, next) {
Pablo Greco e6a3ae
-- 
Pablo Greco e6a3ae
1.8.3.1
Pablo Greco e6a3ae