* [Qemu-devel] [PATCH] tests/test-bdrv-drain: Fix too late qemu_event_reset()
@ 2018-10-01 15:10 Kevin Wolf
2018-10-01 16:13 ` Max Reitz
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Wolf @ 2018-10-01 15:10 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, mreitz, peter.maydell, qemu-devel
qemu_event_reset() must be called before the AIO request in a different
iothread is submitted. Otherwise the request could be completed before
we do the qemu_event_reset() and the test would hang in
qemu_event_wait().
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/test-bdrv-drain.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c
index c9f29c8b10..ee1740ff06 100644
--- a/tests/test-bdrv-drain.c
+++ b/tests/test-bdrv-drain.c
@@ -694,6 +694,8 @@ static void test_iothread_common(enum drain_type drain_type, int drain_thread)
s->bh_indirection_ctx = ctx_b;
aio_ret = -EINPROGRESS;
+ qemu_event_reset(&done_event);
+
if (drain_thread == 0) {
acb = blk_aio_preadv(blk, 0, &qiov, 0, test_iothread_aio_cb, &aio_ret);
} else {
@@ -723,7 +725,6 @@ static void test_iothread_common(enum drain_type drain_type, int drain_thread)
* but the drain in this thread can continue immediately after
* bdrv_dec_in_flight() and aio_ret might be assigned only slightly
* later. */
- qemu_event_reset(&done_event);
do_drain_begin(drain_type, bs);
g_assert_cmpint(bs->in_flight, ==, 0);
@@ -743,7 +744,6 @@ static void test_iothread_common(enum drain_type drain_type, int drain_thread)
}
break;
case 1:
- qemu_event_reset(&done_event);
aio_bh_schedule_oneshot(ctx_a, test_iothread_drain_entry, &data);
qemu_event_wait(&done_event);
break;
--
2.13.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] tests/test-bdrv-drain: Fix too late qemu_event_reset()
2018-10-01 15:10 [Qemu-devel] [PATCH] tests/test-bdrv-drain: Fix too late qemu_event_reset() Kevin Wolf
@ 2018-10-01 16:13 ` Max Reitz
0 siblings, 0 replies; 2+ messages in thread
From: Max Reitz @ 2018-10-01 16:13 UTC (permalink / raw)
To: Kevin Wolf, qemu-block; +Cc: peter.maydell, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 638 bytes --]
On 01.10.18 17:10, Kevin Wolf wrote:
> qemu_event_reset() must be called before the AIO request in a different
> iothread is submitted. Otherwise the request could be completed before
> we do the qemu_event_reset() and the test would hang in
> qemu_event_wait().
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> tests/test-bdrv-drain.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Max Reitz <mreitz@redhat.com>
Tested-by: Max Reitz <mreitz@redhat.com>
(I still got the same hang as the one you just reported, though -- but
it happens just very rarely, so it's definitely better.)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-01 16:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-01 15:10 [Qemu-devel] [PATCH] tests/test-bdrv-drain: Fix too late qemu_event_reset() Kevin Wolf
2018-10-01 16:13 ` Max Reitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).