dma-helpers: dma_blk_io() cancel support
commit5fa78b2a1ca228255cb4a492ebf16cbb8d80c111
authorStefan Hajnoczi <stefanha@redhat.com>
Mon, 20 Jun 2016 19:36:57 +0000 (20 20:36 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 28 Jun 2016 12:08:31 +0000 (28 13:08 +0100)
tree6bf0b8de92ef952f2e118eede00dc93c3ac538db
parent17c42b1f6bc22c64e36b7172990ac65f00be173b
dma-helpers: dma_blk_io() cancel support

Attempting to cancel a dma_blk_io() request causes an abort(3):

  void bdrv_aio_cancel(BlockAIOCB *acb)
  {
      ...
      while (acb->refcnt > 1) {
          if (acb->aiocb_info->get_aio_context) {
              aio_poll(acb->aiocb_info->get_aio_context(acb), true);
          } else if (acb->bs) {
              aio_poll(bdrv_get_aio_context(acb->bs), true);
          } else {
              abort();
          }
      }
      ...
  }

This happens because DMAAIOCB->bs is NULL and
dma_aiocb_info.get_aio_context() is also NULL.

This patch trivially implements dma_aiocb_info.get_aio_context() by
fetching the DMAAIOCB->ctx field.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 1466451417-27988-1-git-send-email-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
dma-helpers.c