On Thu, Oct 07, 2021 at 03:47:42PM +0200, Emanuele Giuseppe Esposito wrote:
>
>
> On 07/10/2021 14:02, Paolo Bonzini wrote:
> > > --- a/block/io.c
> > > +++ b/block/io.c
> > > @@ -739,6 +739,11 @@ void bdrv_drain_all(void)
> > > bdrv_drain_all_end();
> > > }
> > > +void assert_bdrv_graph_writable(BlockDriverState *bs)
> > > +{
> > > + g_assert(qatomic_read(&bs->quiesce_counter) > 0 ||
> > > qemu_in_main_thread());
> > > +}
> >
> > Hmm, wait - I think this should be an "&&", not an OR?
> >
>
> You are right, && makes more sense. But as you said, using an AND will make
> the assertion fail in multiple places, because the necessary drains are
> missing. So I am going to remove the check for drains and leave it as todo.
> I will handle this case in another patch.BTW when an assertion expression tests unrelated things it helps to use separate assert() calls instead of &&. That way it's obvious which sub-expression failed from the error message and it's not necessary to inspect the coredump. In other words: assert(a && b) -> Assertion `a && b` failed. This doesn't tell me whether it was a or b that was false. The assertion failure is easier to diagnose if you split it: assert(a); -> Assertion `a` failed. assert(b); -> Assertion `b` failed. Stefan
signature.asc
Description: PGP signature
