Message ID | 20180411163940.2523-6-kwolf@redhat.com |
---|---|
State | New |
Headers | show |
Series | Drain fixes and cleanups, part 3 | expand |
On 04/11/2018 11:39 AM, Kevin Wolf wrote: > 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. We > can consider it compatible now the latest, after having removed the old s/the latest/at last/ ? > polling code as dead code. > > Enable the coroutine test cases for bdrv_drain_all(). > > Signed-off-by: Kevin Wolf <kwolf@redhat.com> > --- > tests/test-bdrv-drain.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) >
On Wed, Apr 11, 2018 at 06:39:26PM +0200, Kevin Wolf wrote: > 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. We > can consider it compatible now the latest, after having removed the old > polling code as dead code. > > Enable the coroutine test cases for bdrv_drain_all(). > > Signed-off-by: Kevin Wolf <kwolf@redhat.com> > --- > tests/test-bdrv-drain.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c index cd870609c5..6de525b509 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); @@ -795,7 +805,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); @@ -806,7 +817,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);
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. We can consider it compatible now the latest, after having removed the old polling code as dead code. Enable the coroutine test cases for bdrv_drain_all(). Signed-off-by: Kevin Wolf <kwolf@redhat.com> --- tests/test-bdrv-drain.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)