Skip to content
Snippets Groups Projects
  • Paolo Bonzini's avatar
    539343c0
    dma-helpers: ensure AIO callback is invoked after cancellation · 539343c0
    Paolo Bonzini authored
    
    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: default avatarJohn Snow <jsnow@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Message-id: 20190729213416.1972-1-pbonzini@redhat.com
    Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
    539343c0
    History
    dma-helpers: ensure AIO callback is invoked after cancellation
    Paolo Bonzini authored
    
    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: default avatarJohn Snow <jsnow@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Message-id: 20190729213416.1972-1-pbonzini@redhat.com
    Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>