Blame SOURCES/kvm-tests-test-bdrv-drain-bdrv_drain_all-works-in-corout.patch

26ba25
From 6d23d16153f4fe9c01c9f2e02620ce324219b027 Mon Sep 17 00:00:00 2001
26ba25
From: Kevin Wolf <kwolf@redhat.com>
26ba25
Date: Wed, 10 Oct 2018 20:08:39 +0100
26ba25
Subject: [PATCH 08/49] tests/test-bdrv-drain: bdrv_drain_all() works in
26ba25
 coroutines now
26ba25
26ba25
RH-Author: Kevin Wolf <kwolf@redhat.com>
26ba25
Message-id: <20181010200843.6710-6-kwolf@redhat.com>
26ba25
Patchwork-id: 82582
26ba25
O-Subject: [RHEL-8 qemu-kvm PATCH 05/44] tests/test-bdrv-drain: bdrv_drain_all() works in coroutines now
26ba25
Bugzilla: 1637976
26ba25
RH-Acked-by: Max Reitz <mreitz@redhat.com>
26ba25
RH-Acked-by: John Snow <jsnow@redhat.com>
26ba25
RH-Acked-by: Thomas Huth <thuth@redhat.com>
26ba25
26ba25
Since we use bdrv_do_drained_begin/end() for bdrv_drain_all_begin/end(),
26ba25
coroutine context is automatically left with a BH, preventing the
26ba25
deadlocks that made bdrv_drain_all*() unsafe in coroutine context. Now
26ba25
that we even removed the old polling code as dead code, it's obvious
26ba25
that it's compatible now.
26ba25
26ba25
Enable the coroutine test cases for bdrv_drain_all().
26ba25
26ba25
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
26ba25
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
26ba25
(cherry picked from commit 6d0252f2f9cb49925deb1c41101462c9481dfc90)
26ba25
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 tests/test-bdrv-drain.c | 16 ++++++++++++++--
26ba25
 1 file changed, 14 insertions(+), 2 deletions(-)
26ba25
26ba25
diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c
26ba25
index f1276a1..f5d85c9 100644
26ba25
--- a/tests/test-bdrv-drain.c
26ba25
+++ b/tests/test-bdrv-drain.c
26ba25
@@ -233,6 +233,11 @@ static void test_drv_cb_drain_subtree(void)
26ba25
     test_drv_cb_common(BDRV_SUBTREE_DRAIN, true);
26ba25
 }
26ba25
 
26ba25
+static void test_drv_cb_co_drain_all(void)
26ba25
+{
26ba25
+    call_in_coroutine(test_drv_cb_drain_all);
26ba25
+}
26ba25
+
26ba25
 static void test_drv_cb_co_drain(void)
26ba25
 {
26ba25
     call_in_coroutine(test_drv_cb_drain);
26ba25
@@ -289,6 +294,11 @@ static void test_quiesce_drain_subtree(void)
26ba25
     test_quiesce_common(BDRV_SUBTREE_DRAIN, true);
26ba25
 }
26ba25
 
26ba25
+static void test_quiesce_co_drain_all(void)
26ba25
+{
26ba25
+    call_in_coroutine(test_quiesce_drain_all);
26ba25
+}
26ba25
+
26ba25
 static void test_quiesce_co_drain(void)
26ba25
 {
26ba25
     call_in_coroutine(test_quiesce_drain);
26ba25
@@ -795,7 +805,8 @@ int main(int argc, char **argv)
26ba25
     g_test_add_func("/bdrv-drain/driver-cb/drain_subtree",
26ba25
                     test_drv_cb_drain_subtree);
26ba25
 
26ba25
-    // XXX bdrv_drain_all() doesn't work in coroutine context
26ba25
+    g_test_add_func("/bdrv-drain/driver-cb/co/drain_all",
26ba25
+                    test_drv_cb_co_drain_all);
26ba25
     g_test_add_func("/bdrv-drain/driver-cb/co/drain", test_drv_cb_co_drain);
26ba25
     g_test_add_func("/bdrv-drain/driver-cb/co/drain_subtree",
26ba25
                     test_drv_cb_co_drain_subtree);
26ba25
@@ -806,7 +817,8 @@ int main(int argc, char **argv)
26ba25
     g_test_add_func("/bdrv-drain/quiesce/drain_subtree",
26ba25
                     test_quiesce_drain_subtree);
26ba25
 
26ba25
-    // XXX bdrv_drain_all() doesn't work in coroutine context
26ba25
+    g_test_add_func("/bdrv-drain/quiesce/co/drain_all",
26ba25
+                    test_quiesce_co_drain_all);
26ba25
     g_test_add_func("/bdrv-drain/quiesce/co/drain", test_quiesce_co_drain);
26ba25
     g_test_add_func("/bdrv-drain/quiesce/co/drain_subtree",
26ba25
                     test_quiesce_co_drain_subtree);
26ba25
-- 
26ba25
1.8.3.1
26ba25