]> xenbits.xensource.com Git - qemu-xen.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)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 28 Oct 2019 04:28:10 +0000 (23:28 -0500)
commitfbde196c30e4797a51bda046ba514b187963d4ba
tree2057917187ba7d08bda64e48090997536593ac3f
parent9e06029aea3b2eca1d5261352e695edc1e7d7b8b
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>
(cherry picked from commit 539343c0a47e19d5dd64d846d64d084d9793681f)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
dma-helpers.c