From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aCHXE-0000FJ-Tz for qemu-devel@nongnu.org; Thu, 24 Dec 2015 20:51:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aCHXE-000727-5h for qemu-devel@nongnu.org; Thu, 24 Dec 2015 20:51:12 -0500 Date: Fri, 25 Dec 2015 09:51:03 +0800 From: Fam Zheng Message-ID: <20151225015103.GA26066@ad.usersys.redhat.com> References: <1450867706-19860-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1450867706-19860-1-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH] block: acquire in bdrv_query_image_info List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org On Wed, 12/23 11:48, Paolo Bonzini wrote: > NFS calls aio_poll inside bdrv_get_allocated_size. This requires > acquiring the AioContext. > > Signed-off-by: Paolo Bonzini > --- > block/qapi.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/block/qapi.c b/block/qapi.c > index fecac25..ea400e0 100644 > --- a/block/qapi.c > +++ b/block/qapi.c > @@ -210,11 +210,13 @@ void bdrv_query_image_info(BlockDriverState *bs, > Error *err = NULL; > ImageInfo *info; > > + aio_context_acquire(bdrv_get_aio_context(bs)); > + > size = bdrv_getlength(bs); > if (size < 0) { > error_setg_errno(errp, -size, "Can't get size of device '%s'", > bdrv_get_device_name(bs)); > - return; > + goto out; > } > > info = g_new0(ImageInfo, 1); > @@ -281,10 +283,13 @@ void bdrv_query_image_info(BlockDriverState *bs, > default: > error_propagate(errp, err); > qapi_free_ImageInfo(info); > - return; > + goto out; > } > > *p_info = info; > + > +out: > + aio_context_release(bdrv_get_aio_context(bs)); > } > > /* @p_info will be set only on success. */ > -- > 2.5.0 > > Reviewed-by: Fam Zheng