On Wed, 09/03 13:28, Paolo Bonzini wrote:
> Il 03/09/2014 13:23, Fam Zheng ha scritto:
> > All the difference is that the old .cancel doesn't call cb, but
> > .cancel_async does.
> 
> This requires auditing all callbacks though, doesn't it?  Or at least
> adding an
> 
>     if (ret == -ECANCELED) {
>         return;
>     }
> 
> at the beginning.

You are right, this is an unexpected error code for ide at least.

Fam

> 
> Paolo
> 
> > Signed-off-by: Fam Zheng <[email protected]>
> > ---
> >  block.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/block.c b/block.c
> > index 4aa1bd7..b7253af 100644
> > --- a/block.c
> > +++ b/block.c
> > @@ -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);
> > @@ -4686,7 +4689,7 @@ static void bdrv_aio_cancel_em(BlockDriverAIOCB 
> > *blockacb)
> >  
> >  static const AIOCBInfo bdrv_em_aiocb_info = {
> >      .aiocb_size         = sizeof(BlockDriverAIOCBSync),
> > -    .cancel             = bdrv_aio_cancel_em,
> > +    .cancel_async       = bdrv_aio_cancel_em,
> >  };
> >  
> >  static void bdrv_aio_bh_cb(void *opaque)
> > 
> 

Reply via email to