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

357786
From 0ace323e4037200dc16bda1d77bbdc4f2711a658 Mon Sep 17 00:00:00 2001
357786
From: Kevin Wolf <kwolf@redhat.com>
357786
Date: Fri, 14 Sep 2018 10:55:03 +0200
357786
Subject: [PATCH 12/49] tests/test-bdrv-drain: bdrv_drain_all() works in
357786
 coroutines now
357786
357786
RH-Author: Kevin Wolf <kwolf@redhat.com>
357786
Message-id: <20180914105540.18077-6-kwolf@redhat.com>
357786
Patchwork-id: 82156
357786
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 05/42] tests/test-bdrv-drain: bdrv_drain_all() works in coroutines now
357786
Bugzilla: 1601212
357786
RH-Acked-by: John Snow <jsnow@redhat.com>
357786
RH-Acked-by: Max Reitz <mreitz@redhat.com>
357786
RH-Acked-by: Fam Zheng <famz@redhat.com>
357786
357786
Since we use bdrv_do_drained_begin/end() for bdrv_drain_all_begin/end(),
357786
coroutine context is automatically left with a BH, preventing the
357786
deadlocks that made bdrv_drain_all*() unsafe in coroutine context. Now
357786
that we even removed the old polling code as dead code, it's obvious
357786
that it's compatible now.
357786
357786
Enable the coroutine test cases for bdrv_drain_all().
357786
357786
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
357786
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
357786
(cherry picked from commit 6d0252f2f9cb49925deb1c41101462c9481dfc90)
357786
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 tests/test-bdrv-drain.c | 16 ++++++++++++++--
357786
 1 file changed, 14 insertions(+), 2 deletions(-)
357786
357786
diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c
357786
index f1276a1..f5d85c9 100644
357786
--- a/tests/test-bdrv-drain.c
357786
+++ b/tests/test-bdrv-drain.c
357786
@@ -233,6 +233,11 @@ static void test_drv_cb_drain_subtree(void)
357786
     test_drv_cb_common(BDRV_SUBTREE_DRAIN, true);
357786
 }
357786
 
357786
+static void test_drv_cb_co_drain_all(void)
357786
+{
357786
+    call_in_coroutine(test_drv_cb_drain_all);
357786
+}
357786
+
357786
 static void test_drv_cb_co_drain(void)
357786
 {
357786
     call_in_coroutine(test_drv_cb_drain);
357786
@@ -289,6 +294,11 @@ static void test_quiesce_drain_subtree(void)
357786
     test_quiesce_common(BDRV_SUBTREE_DRAIN, true);
357786
 }
357786
 
357786
+static void test_quiesce_co_drain_all(void)
357786
+{
357786
+    call_in_coroutine(test_quiesce_drain_all);
357786
+}
357786
+
357786
 static void test_quiesce_co_drain(void)
357786
 {
357786
     call_in_coroutine(test_quiesce_drain);
357786
@@ -795,7 +805,8 @@ int main(int argc, char **argv)
357786
     g_test_add_func("/bdrv-drain/driver-cb/drain_subtree",
357786
                     test_drv_cb_drain_subtree);
357786
 
357786
-    // XXX bdrv_drain_all() doesn't work in coroutine context
357786
+    g_test_add_func("/bdrv-drain/driver-cb/co/drain_all",
357786
+                    test_drv_cb_co_drain_all);
357786
     g_test_add_func("/bdrv-drain/driver-cb/co/drain", test_drv_cb_co_drain);
357786
     g_test_add_func("/bdrv-drain/driver-cb/co/drain_subtree",
357786
                     test_drv_cb_co_drain_subtree);
357786
@@ -806,7 +817,8 @@ int main(int argc, char **argv)
357786
     g_test_add_func("/bdrv-drain/quiesce/drain_subtree",
357786
                     test_quiesce_drain_subtree);
357786
 
357786
-    // XXX bdrv_drain_all() doesn't work in coroutine context
357786
+    g_test_add_func("/bdrv-drain/quiesce/co/drain_all",
357786
+                    test_quiesce_co_drain_all);
357786
     g_test_add_func("/bdrv-drain/quiesce/co/drain", test_quiesce_co_drain);
357786
     g_test_add_func("/bdrv-drain/quiesce/co/drain_subtree",
357786
                     test_quiesce_co_drain_subtree);
357786
-- 
357786
1.8.3.1
357786