On Tue, Oct 05, 2021 at 10:31:53AM -0400, Emanuele Giuseppe Esposito wrote: > All the global state (GS) API functions will check that > qemu_in_main_thread() returns true. If not, it means > that the safety of BQL cannot be guaranteed, and > they need to be moved to I/O. > > Signed-off-by: Emanuele Giuseppe Esposito <eespo...@redhat.com> > --- > block/block-backend.c | 89 +++++++++++++++++++++++++++++++++++++++++- > softmmu/qdev-monitor.c | 2 + > 2 files changed, 90 insertions(+), 1 deletion(-) > > diff --git a/block/block-backend.c b/block/block-backend.c > index d31ae16b99..9cd3b27b53 100644 > --- a/block/block-backend.c > +++ b/block/block-backend.c > @@ -227,6 +227,7 @@ static void blk_root_activate(BdrvChild *child, Error > **errp) > > void blk_set_force_allow_inactivate(BlockBackend *blk) > { > + g_assert(qemu_in_main_thread());
Why g_assert()? > @@ -661,6 +676,7 @@ bool monitor_add_blk(BlockBackend *blk, const char *name, > Error **errp) > { > assert(!blk->name); > assert(name && name[0]); > + g_assert(qemu_in_main_thread()); especially why mixed spellings? Per osdep.h, we don't support builds with NDEBUG or G_DISABLE_ASSERT defined to their non-default values, so behavior isn't really different, but consistency says we use 'assert' more frequently than 'g_assert'. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org