]> git.proxmox.com Git - mirror_qemu.git/commit
dma-helpers: ensure AIO callback is invoked after cancellation
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 29 Jul 2019 21:34:16 +0000 (23:34 +0200)
committerJohn Snow <jsnow@redhat.com>
Fri, 16 Aug 2019 23:14:04 +0000 (19:14 -0400)
commit539343c0a47e19d5dd64d846d64d084d9793681f
tree89f44bbc711b000ba4661636f2b1cc83b878602e
parentafd760539308a5524accf964107cdb1d54a059e3
dma-helpers: ensure AIO callback is invoked after cancellation

dma_aio_cancel unschedules the BH if there is one, which corresponds
to the reschedule_dma case of dma_blk_cb.  This can stall the DMA
permanently, because dma_complete will never get invoked and therefore
nobody will ever invoke the original AIO callback in dbs->common.cb.

Fix this by invoking the callback (which is ensured to happen after
a bdrv_aio_cancel_async, or done manually in the dbs->bh case), and
add assertions to check that the DMA state machine is indeed waiting
for dma_complete or reschedule_dma, but never both.

Reported-by: John Snow <jsnow@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20190729213416.1972-1-pbonzini@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
dma-helpers.c