On 13/09/2018 14:52, Kevin Wolf wrote: > bdrv_do_drained_begin/end() assume that they are called with the > AioContext lock of bs held. If we call drain functions from a coroutine > with the AioContext lock held, we yield and schedule a BH to move out of > coroutine context. This means that the lock for the home context of the > coroutine is released and must be re-acquired in the bottom half.
What exactly needs the lock, is it bdrv_drain_invoke? Would it make sense to always do release/acquire in bdrv_drain, and always do acquire/release in bdrv_drain_invoke? (Conditional locking is tricky...). Thanks, Paolo