Message ID | 1409743435-21155-12-git-send-email-famz@redhat.com |
---|---|
State | New |
Headers | show |
Il 03/09/2014 13:23, Fam Zheng ha scritto: > static void blkdebug_aio_cancel(BlockDriverAIOCB *blockacb) > { > BlkdebugAIOCB *acb = container_of(blockacb, BlkdebugAIOCB, common); > + acb->ret = -ECANCELED; > + acb->common.cb(acb->common.opaque, acb->ret); > if (acb->bh) { > qemu_bh_delete(acb->bh); > acb->bh = NULL; I think you shouldn't invoke the callback here, and instead you can just let the bottom half do the work. Actually, a no-op implementation of blkdebug_aio_cancel would work. Paolo
diff --git a/block/blkdebug.c b/block/blkdebug.c index 69b330e..9f23530 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -55,8 +55,8 @@ typedef struct BlkdebugSuspendedReq { static void blkdebug_aio_cancel(BlockDriverAIOCB *blockacb); static const AIOCBInfo blkdebug_aiocb_info = { - .aiocb_size = sizeof(BlkdebugAIOCB), - .cancel = blkdebug_aio_cancel, + .aiocb_size = sizeof(BlkdebugAIOCB), + .cancel_async = blkdebug_aio_cancel, }; enum { @@ -453,6 +453,8 @@ static void error_callback_bh(void *opaque) static void blkdebug_aio_cancel(BlockDriverAIOCB *blockacb) { BlkdebugAIOCB *acb = container_of(blockacb, BlkdebugAIOCB, common); + acb->ret = -ECANCELED; + acb->common.cb(acb->common.opaque, acb->ret); if (acb->bh) { qemu_bh_delete(acb->bh); acb->bh = NULL;
Signed-off-by: Fam Zheng <famz@redhat.com> --- block/blkdebug.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)