diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2019-10-03 11:01:03 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2019-10-14 09:48:01 +0100 |
commit | 69de48445a0d6169f1e2a6c5bfab994e1c810e33 (patch) | |
tree | 3b47dc751f350d2361f5bbd4fccc271088f0e04f /qapi/qom.json | |
parent | 98b2e3c9ab3abfe476a2b02f8f51813edb90e72d (diff) | |
download | qemu-69de48445a0d6169f1e2a6c5bfab994e1c810e33.zip |
test-bdrv-drain: fix iothread_join() hang
tests/test-bdrv-drain can hang in tests/iothread.c:iothread_run():
while (!atomic_read(&iothread->stopping)) {
aio_poll(iothread->ctx, true);
}
The iothread_join() function works as follows:
void iothread_join(IOThread *iothread)
{
iothread->stopping = true;
aio_notify(iothread->ctx);
qemu_thread_join(&iothread->thread);
If iothread_run() checks iothread->stopping before the iothread_join()
thread sets stopping to true, then aio_notify() may be optimized away
and iothread_run() hangs forever in aio_poll().
The correct way to change iothread->stopping is from a BH that executes
within iothread_run(). This ensures that iothread->stopping is checked
after we set it to true.
This was already fixed for ./iothread.c (note this is a different source
file!) by commit 2362a28ea11c145e1a13ae79342d76dc118a72a6 ("iothread:
fix iothread_stop() race condition"), but not for tests/iothread.c.
Fixes: 0c330a734b51c177ab8488932ac3b0c4d63a718a
("aio: introduce aio_co_schedule and aio_co_wake")
Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20191003100103.331-1-stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'qapi/qom.json')
0 files changed, 0 insertions, 0 deletions