From patchwork Tue Jul 19 07:52:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 105400 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5C9AAB6F7E for ; Tue, 19 Jul 2011 17:52:08 +1000 (EST) Received: from localhost ([::1]:51123 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qj563-0005oy-Js for incoming@patchwork.ozlabs.org; Tue, 19 Jul 2011 03:52:03 -0400 Received: from eggs.gnu.org ([140.186.70.92]:43429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qj53L-0005oM-Ha for qemu-devel@nongnu.org; Tue, 19 Jul 2011 03:49:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qj53J-00048l-IC for qemu-devel@nongnu.org; Tue, 19 Jul 2011 03:49:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qj53J-00048h-0M for qemu-devel@nongnu.org; Tue, 19 Jul 2011 03:49:13 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6J7nA4j014509 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 19 Jul 2011 03:49:10 -0400 Received: from dhcp-5-188.str.redhat.com (dhcp-5-175.str.redhat.com [10.32.5.175]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6J7n8GF004982 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 19 Jul 2011 03:49:10 -0400 Message-ID: <4E2537A5.1080009@redhat.com> Date: Tue, 19 Jul 2011 09:52:05 +0200 From: Kevin Wolf User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc15 Thunderbird/3.1.10 MIME-Version: 1.0 To: Frediano Ziglio References: In-Reply-To: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org Subject: Re: [Qemu-devel] [PATCH] avoid core reading with bdrv_read (qemu-io) 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 Am 19.07.2011 09:33, schrieb Frediano Ziglio: > This patch apply to kevin coroutine-block branch and avoid code. It > fix "qcow: Use coroutines" patch. Test case: > > $ ./qemu-img create -f qcow aaa.img 1G > Formatting 'aaa.img', fmt=qcow size=1073741824 encryption=off > $ ./qemu-io aaa.img > qemu-io> read 1024 1024 > Segmentation fault > > Signed-off-by: Frediano Ziglio Thanks for the report. I'll update the patch, but in a slightly qemu_aio_release(acb); different way that matches the old code better: diff --git a/block/qcow.c b/block/qcow.c index 6f7973c..6447c2a 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -573,7 +573,6 @@ static int qcow_aio_read_cb(void *opaque) if (acb->nb_sectors == 0) { /* request completed */ - qemu_iovec_from_buffer(acb->qiov, acb->orig_buf, acb->qiov->size); return 0; } @@ -647,6 +646,7 @@ static int qcow_co_readv(BlockDriverState *bs, int64_t sector_num, qemu_co_mutex_unlock(&s->lock); if (acb->qiov->niov > 1) { + qemu_iovec_from_buffer(acb->qiov, acb->orig_buf, acb->qiov->size); qemu_vfree(acb->orig_buf); }