aboutsummaryrefslogtreecommitdiff
path: root/tests/test-bdrv-drain.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-04-04 13:26:16 +0200
committerKevin Wolf <kwolf@redhat.com>2018-06-18 15:03:25 +0200
commit6d0252f2f9cb49925deb1c41101462c9481dfc90 (patch)
treec0fba8114304c15c1b3af817c156836c2946495e /tests/test-bdrv-drain.c
parentc13ad59f012cbbccb866a10477458e69bc868dbb (diff)
tests/test-bdrv-drain: bdrv_drain_all() works in coroutines now
Since we use bdrv_do_drained_begin/end() for bdrv_drain_all_begin/end(), coroutine context is automatically left with a BH, preventing the deadlocks that made bdrv_drain_all*() unsafe in coroutine context. Now that we even removed the old polling code as dead code, it's obvious that it's compatible now. Enable the coroutine test cases for bdrv_drain_all(). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/test-bdrv-drain.c')
-rw-r--r--tests/test-bdrv-drain.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c
index c7f107142c..cc03bc171b 100644
--- a/tests/test-bdrv-drain.c
+++ b/tests/test-bdrv-drain.c
@@ -233,6 +233,11 @@ static void test_drv_cb_drain_subtree(void)
test_drv_cb_common(BDRV_SUBTREE_DRAIN, true);
}
+static void test_drv_cb_co_drain_all(void)
+{
+ call_in_coroutine(test_drv_cb_drain_all);
+}
+
static void test_drv_cb_co_drain(void)
{
call_in_coroutine(test_drv_cb_drain);
@@ -289,6 +294,11 @@ static void test_quiesce_drain_subtree(void)
test_quiesce_common(BDRV_SUBTREE_DRAIN, true);
}
+static void test_quiesce_co_drain_all(void)
+{
+ call_in_coroutine(test_quiesce_drain_all);
+}
+
static void test_quiesce_co_drain(void)
{
call_in_coroutine(test_quiesce_drain);
@@ -800,7 +810,8 @@ int main(int argc, char **argv)
g_test_add_func("/bdrv-drain/driver-cb/drain_subtree",
test_drv_cb_drain_subtree);
- // XXX bdrv_drain_all() doesn't work in coroutine context
+ g_test_add_func("/bdrv-drain/driver-cb/co/drain_all",
+ test_drv_cb_co_drain_all);
g_test_add_func("/bdrv-drain/driver-cb/co/drain", test_drv_cb_co_drain);
g_test_add_func("/bdrv-drain/driver-cb/co/drain_subtree",
test_drv_cb_co_drain_subtree);
@@ -811,7 +822,8 @@ int main(int argc, char **argv)
g_test_add_func("/bdrv-drain/quiesce/drain_subtree",
test_quiesce_drain_subtree);
- // XXX bdrv_drain_all() doesn't work in coroutine context
+ g_test_add_func("/bdrv-drain/quiesce/co/drain_all",
+ test_quiesce_co_drain_all);
g_test_add_func("/bdrv-drain/quiesce/co/drain", test_quiesce_co_drain);
g_test_add_func("/bdrv-drain/quiesce/co/drain_subtree",
test_quiesce_co_drain_subtree);