qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/3] block: add missed aio_context_acquire aroun


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 1/3] block: add missed aio_context_acquire around bdrv_set_aio_context
Date: Fri, 6 Nov 2015 13:35:45 +0000
User-agent: Mutt/1.5.23 (2015-06-09)

On Wed, Nov 04, 2015 at 08:27:22PM +0300, Denis V. Lunev wrote:
> It is required for bdrv_drain.

What bug does this patch fix?

Existing blk_set_aio_context() callers acquire the AioContext or are
sure it's already acquired by their caller, so I don't see where the bug
is.

No function in block/block-backend.c acquires AioContext internally.
The same reasoning I mentioned in another email thread about consistent
locking strategy applies here.  Either all blk_*() functions should take
the AioContext internally (which I disagree with) or none of them should
take it.

> Signed-off-by: Denis V. Lunev <address@hidden>
> CC: Stefan Hajnoczi <address@hidden>
> ---
>  block/block-backend.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/block/block-backend.c b/block/block-backend.c
> index 19fdaae..07fcfc7 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -1065,7 +1065,10 @@ static AioContext 
> *blk_aiocb_get_aio_context(BlockAIOCB *acb)
>  void blk_set_aio_context(BlockBackend *blk, AioContext *new_context)
>  {
>      if (blk->bs) {
> +        AioContext *ctx = blk_get_aio_context(blk);
> +        aio_context_acquire(ctx);
>          bdrv_set_aio_context(blk->bs, new_context);
> +        aio_context_release(ctx);
>      }
>  }
>  
> -- 
> 2.5.0
> 
> 

Attachment: signature.asc
Description: PGP signature


reply via email to

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