Received: from [140.186.70.92] (port=47860 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pmrbq-0007Vh-I8 for qemu-devel@nongnu.org; Tue, 08 Feb 2011 12:44:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pmrbp-0004NX-IS for qemu-devel@nongnu.org; Tue, 08 Feb 2011 12:44:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:26385) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pmrbp-0004NM-BI for qemu-devel@nongnu.org; Tue, 08 Feb 2011 12:44:13 -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 p18HiBqT027672 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 8 Feb 2011 12:44:11 -0500 From: Markus Armbruster 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> Date: Tue, 08 Feb 2011 18:43:56 +0100 In-Reply-To: <1297185328-23210-1-git-send-email-kwolf@redhat.com> (Kevin Wolf's message of "Tue, 8 Feb 2011 18:15:28 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org 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?