From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIXtn-0007NI-OH for qemu-devel@nongnu.org; Mon, 11 Jan 2016 03:32:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIXtm-0006sE-Vs for qemu-devel@nongnu.org; Mon, 11 Jan 2016 03:32:23 -0500 Sender: Paolo Bonzini References: <1450867706-19860-1-git-send-email-pbonzini@redhat.com> <20151225015103.GA26066@ad.usersys.redhat.com> From: Paolo Bonzini Message-ID: <56936890.5080206@redhat.com> Date: Mon, 11 Jan 2016 09:32:16 +0100 MIME-Version: 1.0 In-Reply-To: <20151225015103.GA26066@ad.usersys.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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: Fam Zheng Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org On 25/12/2015 02:51, Fam Zheng wrote: > 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 > > Ping? Paolo