On 11/3/22 14:41, Emanuele Giuseppe Esposito wrote:
- for (i = 0; i < bs->quiesce_counter; i++) {
- if (drv->bdrv_co_drain_begin) {
- drv->bdrv_co_drain_begin(bs);
- }
+ if (drv->bdrv_co_drain_begin) {
+ co = qemu_coroutine_create(bdrv_co_drain_begin, &dco);
+ qemu_coroutine_enter(co);
+ AIO_WAIT_WHILE(qemu_get_aio_context(), dco.ret == NOT_DONE);
}
Alternatively there should be no reason for drv->bdrv_co_drain_begin to
wait at this point, because the device does not have any active I/O. So
you could also assert that the coroutine is terminated after
qemu_coroutine_enter(), i.e. that dco.ret != NOT_DONE.
Since you need to respin, perhaps put it the above in the commit message
in case this needs a change in the future; however your patch is simple
and should indeed work, so
Reviewed-by: Paolo Bonzini <[email protected]>
Paolo