From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9MvA-0007Eg-9a for qemu-devel@nongnu.org; Wed, 16 Dec 2015 19:59:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9Mv7-0002fi-2h for qemu-devel@nongnu.org; Wed, 16 Dec 2015 19:59:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50375) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9Mv6-0002eu-T7 for qemu-devel@nongnu.org; Wed, 16 Dec 2015 19:59:48 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 667C0693CB for ; Thu, 17 Dec 2015 00:59:48 +0000 (UTC) Date: Thu, 17 Dec 2015 08:59:46 +0800 From: Fam Zheng Message-ID: <20151217005946.GA20007@ad.usersys.redhat.com> References: <1450290827-30508-5-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1450290827-30508-5-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH] block: fix bdrv_ioctl called from coroutine List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On Wed, 12/16 19:33, Paolo Bonzini wrote: > When called from a coroutine, bdrv_ioctl must be asynchronous just like > e.g. bdrv_flush. The code was incorrectly making it synchronous, fix > it. > > Signed-off-by: Paolo Bonzini > --- > Fam, any reason why you did it this way? I don't see > any coroutine caller, but it doesn't make much sense. :) That is a surprising question! From a coroutine, it is bdrv_flush -> bdrv_flush_co_entry -> bdrv_co_flush, which I think is always synchronous, especially, noticing the code around calling bs->bdrv_aio_flush: acb = bs->drv->bdrv_aio_flush(bs, bdrv_co_io_em_complete, &co); if (acb == NULL) { ret = -EIO; } else { qemu_coroutine_yield(); ret = co.ret; } Am I missing something? Fam > > block/io.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/block/io.c b/block/io.c > index e00fb5d..841f5b5 100644 > --- a/block/io.c > +++ b/block/io.c > @@ -2614,10 +2614,11 @@ int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf) > bdrv_co_ioctl_entry(&data); > } else { > Coroutine *co = qemu_coroutine_create(bdrv_co_ioctl_entry); > + > qemu_coroutine_enter(co, &data); > - } > - while (data.ret == -EINPROGRESS) { > - aio_poll(bdrv_get_aio_context(bs), true); > + while (data.ret == -EINPROGRESS) { > + aio_poll(bdrv_get_aio_context(bs), true); > + } > } > return data.ret; > } > -- > 2.5.0 >