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>
This commit is contained in:
parent
6ee7c82d0d
commit
3e6bed619a
@ -686,7 +686,7 @@ void monitor_cleanup(void)
|
|||||||
|
|
||||||
AIO_WAIT_WHILE_UNLOCKED(NULL,
|
AIO_WAIT_WHILE_UNLOCKED(NULL,
|
||||||
(aio_poll(iohandler_get_aio_context(), false),
|
(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),
|
* We need to explicitly stop the I/O thread (but not destroy it),
|
||||||
|
@ -226,6 +226,7 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data)
|
|||||||
|
|
||||||
/* On shutdown, don't take any more requests from the queue */
|
/* On shutdown, don't take any more requests from the queue */
|
||||||
if (qmp_dispatcher_co_shutdown) {
|
if (qmp_dispatcher_co_shutdown) {
|
||||||
|
qatomic_set(&qmp_dispatcher_co, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,6 +251,7 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data)
|
|||||||
* yielded and were reentered from monitor_cleanup()
|
* yielded and were reentered from monitor_cleanup()
|
||||||
*/
|
*/
|
||||||
if (qmp_dispatcher_co_shutdown) {
|
if (qmp_dispatcher_co_shutdown) {
|
||||||
|
qatomic_set(&qmp_dispatcher_co, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user