yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-Fix-AioContext-switch-for-drained-node.patch

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