From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=60481 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pn64l-0005Bm-JM for qemu-devel@nongnu.org; Wed, 09 Feb 2011 04:11:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pn64k-0005YI-Fq for qemu-devel@nongnu.org; Wed, 09 Feb 2011 04:11:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:64205) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pn64k-0005Xx-8f for qemu-devel@nongnu.org; Wed, 09 Feb 2011 04:11:02 -0500 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 p199B0C0012623 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 9 Feb 2011 04:11:01 -0500 Message-ID: <4D525A8E.40407@redhat.com> Date: Wed, 09 Feb 2011 10:12:46 +0100 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] qcow2: Fix error handling for immediate backing file read failure References: <1297185328-23210-1-git-send-email-kwolf@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org Am 08.02.2011 18:43, schrieb Markus Armbruster: > Kevin Wolf writes: > >> Requests could return success even though they failed when bdrv_aio_readv >> returned NULL for a backing file read. >> >> Reported-by: Chunqiang Tang >> Signed-off-by: Kevin Wolf >> --- >> block/qcow2.c | 4 +++- >> 1 files changed, 3 insertions(+), 1 deletions(-) >> >> diff --git a/block/qcow2.c b/block/qcow2.c >> index 28338bf..647c2a4 100644 >> --- a/block/qcow2.c >> +++ b/block/qcow2.c >> @@ -479,8 +479,10 @@ static void qcow2_aio_read_cb(void *opaque, int ret) >> BLKDBG_EVENT(bs->file, BLKDBG_READ_BACKING_AIO); >> acb->hd_aiocb = bdrv_aio_readv(bs->backing_hd, acb->sector_num, >> &acb->hd_qiov, n1, qcow2_aio_read_cb, acb); >> - if (acb->hd_aiocb == NULL) >> + if (acb->hd_aiocb == NULL) { >> + ret = -EIO; >> goto done; >> + } >> } else { >> ret = qcow2_schedule_bh(qcow2_aio_read_bh, acb); >> if (ret < 0) > > Good catch. > > Nearby > > if (qcow2_decompress_cluster(bs, acb->cluster_offset) < 0) > goto done; > > looks suspicious to my ignorant eyes. Is it okay? No, it's wrong as well, and it's the second part of Chunquiang Tang's bug report. I started a patch for it yesterday, but didn't have time to test it because I didn't expect my train to wait. ;-) I'll send it today. Kevin