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

383d26
From 3c3659acadf5891119a70e6dd7a2525c2706e1de Mon Sep 17 00:00:00 2001
383d26
From: Kevin Wolf <kwolf@redhat.com>
383d26
Date: Fri, 1 Mar 2019 14:27:45 +0100
383d26
Subject: [PATCH 3/9] block: Fix AioContext switch for drained node
383d26
383d26
RH-Author: Kevin Wolf <kwolf@redhat.com>
383d26
Message-id: <20190301142747.12251-4-kwolf@redhat.com>
383d26
Patchwork-id: 84763
383d26
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 3/5] block: Fix AioContext switch for drained node
383d26
Bugzilla: 1671173
383d26
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
383d26
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
383d26
RH-Acked-by: John Snow <jsnow@redhat.com>
383d26
383d26
When a drained node changes its AioContext, we need to move its
383d26
aio_disable_external() to the new context, too.
383d26
383d26
Without this fix, drain_end will try to reenable the new context, which
383d26
has never been disabled, so an assertion failure is triggered.
383d26
383d26
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
383d26
Reviewed-by: Eric Blake <eblake@redhat.com>
383d26
(cherry picked from commit e64f25f30b80a71bd4e409ed518c39eeb5905166)
383d26
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
383d26
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
---
383d26
 block.c | 7 +++++++
383d26
 1 file changed, 7 insertions(+)
383d26
383d26
diff --git a/block.c b/block.c
383d26
index a69d0a2..7cd3651 100644
383d26
--- a/block.c
383d26
+++ b/block.c
383d26
@@ -4954,6 +4954,9 @@ void bdrv_detach_aio_context(BlockDriverState *bs)
383d26
         bdrv_detach_aio_context(child->bs);
383d26
     }
383d26
 
383d26
+    if (bs->quiesce_counter) {
383d26
+        aio_enable_external(bs->aio_context);
383d26
+    }
383d26
     bs->aio_context = NULL;
383d26
 }
383d26
 
383d26
@@ -4967,6 +4970,10 @@ void bdrv_attach_aio_context(BlockDriverState *bs,
383d26
         return;
383d26
     }
383d26
 
383d26
+    if (bs->quiesce_counter) {
383d26
+        aio_disable_external(new_context);
383d26
+    }
383d26
+
383d26
     bs->aio_context = new_context;
383d26
 
383d26
     QLIST_FOREACH(child, &bs->children, next) {
383d26
-- 
383d26
1.8.3.1
383d26