diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2023-03-03 12:45:29 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2023-05-25 10:18:33 +0200 |
commit | 3e6bed619a1d13858e540e01aae275abdf9146ae (patch) | |
tree | 08715eb19099a77552849001bd2cb273d92060b4 /monitor | |
parent | 6ee7c82d0df9bb6e972a8ea689b935df3ba37486 (diff) |
monitor: cleanup detection of qmp_dispatcher_co shutting down
Instead of overloading qmp_dispatcher_co_busy, make the coroutine
pointer NULL. This will make things break spectacularly if somebody
tries to start a request after monitor_cleanup().
AIO_WAIT_WHILE_UNLOCKED() does not need qatomic_mb_read(), because
the macro contains all the necessary memory barriers.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'monitor')
-rw-r--r-- | monitor/monitor.c | 2 | ||||
-rw-r--r-- | monitor/qmp.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/monitor/monitor.c b/monitor/monitor.c index 15f97538ef..c4ed2547c2 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -686,7 +686,7 @@ void monitor_cleanup(void) AIO_WAIT_WHILE_UNLOCKED(NULL, (aio_poll(iohandler_get_aio_context(), false), - qatomic_mb_read(&qmp_dispatcher_co_busy))); + qatomic_read(&qmp_dispatcher_co))); /* * We need to explicitly stop the I/O thread (but not destroy it), diff --git a/monitor/qmp.c b/monitor/qmp.c index 092c527b6f..f0cc6dc886 100644 --- a/monitor/qmp.c +++ b/monitor/qmp.c @@ -226,6 +226,7 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data) /* On shutdown, don't take any more requests from the queue */ if (qmp_dispatcher_co_shutdown) { + qatomic_set(&qmp_dispatcher_co, NULL); return; } @@ -250,6 +251,7 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data) * yielded and were reentered from monitor_cleanup() */ if (qmp_dispatcher_co_shutdown) { + qatomic_set(&qmp_dispatcher_co, NULL); return; } } |