qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 05/22] block: Convert bdrv_em_aiocb_info.canc


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v5 05/22] block: Convert bdrv_em_aiocb_info.cancel to .cancel_async
Date: Wed, 10 Sep 2014 10:20:35 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

Il 10/09/2014 07:59, Fam Zheng ha scritto:
> @@ -4679,6 +4679,9 @@ static void bdrv_aio_cancel_em(BlockDriverAIOCB 
> *blockacb)
>  {
>      BlockDriverAIOCBSync *acb =
>          container_of(blockacb, BlockDriverAIOCBSync, common);
> +
> +    acb->ret = -ECANCELED;
> +    acb->common.cb(acb->common.opaque, acb->ret);
>      qemu_bh_delete(acb->bh);
>      acb->bh = NULL;
>      qemu_aio_release(acb);

This could call the callback before I/O is finished.  I/O can then
complete and write to disk stuff that was not meant to be written.

I think there is a pre-existing bug, which should be fixed with a "bool
*done" member similar to BlockDriverAIOCBCoroutine's.  But for the sake
of conversion to async cancellation, you can just empty bdrv_aio_cancel_em.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]