From mboxrd@z Thu Jan 1 00:00:00 1970 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 Message-ID: <4E2537A5.1080009@redhat.com> Date: Tue, 19 Jul 2011 09:52:05 +0200 From: Kevin Wolf MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] avoid core reading with bdrv_read (qemu-io) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Frediano Ziglio Cc: qemu-devel@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 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); } qemu_aio_release(acb);