Re: [PATCH for-7.1 5/8] nbd: use a QemuMutex to synchronize reconnection with coroutines

2022-04-13 Thread Paolo Bonzini
On 4/13/22 17:55, Eric Blake wrote: -g_assert(qemu_in_coroutine()); Why is this assert dropped? Is it because we've marked the function with coroutine_fn? If so, should we drop it earlier in the series, when you added the label? The label doesn't guarantee much, but in this case it's pre

Re: [PATCH for-7.1 5/8] nbd: use a QemuMutex to synchronize reconnection with coroutines

2022-04-13 Thread Eric Blake
On Tue, Apr 12, 2022 at 09:42:01PM +0200, Paolo Bonzini wrote: > The condition for waiting on the s->free_sema queue depends on > both s->in_flight and s->state. The latter is currently using > atomics, but this is quite dubious and probably wrong. > > Because s->state is written in the main thre

Re: [PATCH for-7.1 5/8] nbd: use a QemuMutex to synchronize reconnection with coroutines

2022-04-13 Thread Paolo Bonzini
On 4/12/22 21:42, Paolo Bonzini wrote: Because s->state is written in the main thread too, for example by the reconnect timer callback, it cannot be protected by a CoMutex. Actually by the yank callback, not the timer (which runs in the "right" AioContext). Paolo

[PATCH for-7.1 5/8] nbd: use a QemuMutex to synchronize reconnection with coroutines

2022-04-12 Thread Paolo Bonzini
The condition for waiting on the s->free_sema queue depends on both s->in_flight and s->state. The latter is currently using atomics, but this is quite dubious and probably wrong. Because s->state is written in the main thread too, for example by the reconnect timer callback, it cannot be protect