From patchwork Fri Dec 18 15:07:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 558941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46BFB1401CD for ; Sat, 19 Dec 2015 03:26:02 +1100 (AEDT) Received: from localhost ([::1]:33400 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9xqy-0001JY-9y for incoming@patchwork.ozlabs.org; Fri, 18 Dec 2015 11:26:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9weX-0000fW-AX for qemu-devel@nongnu.org; Fri, 18 Dec 2015 10:09:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9weS-0004d9-JX for qemu-devel@nongnu.org; Fri, 18 Dec 2015 10:09:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9weN-0004ab-0t; Fri, 18 Dec 2015 10:08:55 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id BCB06347A6B; Fri, 18 Dec 2015 15:08:54 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-99.ams2.redhat.com [10.36.116.99]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBIF7uDU003029; Fri, 18 Dec 2015 10:08:53 -0500 From: Kevin Wolf To: qemu-block@nongnu.org Date: Fri, 18 Dec 2015 16:07:46 +0100 Message-Id: <1450451274-7472-41-git-send-email-kwolf@redhat.com> In-Reply-To: <1450451274-7472-1-git-send-email-kwolf@redhat.com> References: <1450451274-7472-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 40/48] block: fix bdrv_ioctl called from coroutine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Paolo Bonzini 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 Reviewed-by: Fam Zheng Signed-off-by: Kevin Wolf --- 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; }