From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LqWv6-0004nO-BT for qemu-devel@nongnu.org; Sun, 05 Apr 2009 14:18:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LqWv1-0004ij-SR for qemu-devel@nongnu.org; Sun, 05 Apr 2009 14:18:12 -0400 Received: from [199.232.76.173] (port=59668 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LqWv1-0004iR-A2 for qemu-devel@nongnu.org; Sun, 05 Apr 2009 14:18:07 -0400 Received: from e7.ny.us.ibm.com ([32.97.182.137]:56929) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LqWv1-000807-0V for qemu-devel@nongnu.org; Sun, 05 Apr 2009 14:18:07 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e7.ny.us.ibm.com (8.13.1/8.13.1) with ESMTP id n35I8M1s016891 for ; Sun, 5 Apr 2009 14:08:22 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n35II5f4199110 for ; Sun, 5 Apr 2009 14:18:05 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n35II5Tu021926 for ; Sun, 5 Apr 2009 14:18:05 -0400 Received: from squirrel.codemonkey.ws (sig-9-65-213-73.mts.ibm.com [9.65.213.73]) by d01av03.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n35II43Z021903 for ; Sun, 5 Apr 2009 14:18:05 -0400 Message-ID: <49D8F5DB.5090501@us.ibm.com> Date: Sun, 05 Apr 2009 13:18:03 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Fix (at least one cause of) qcow2 corruption. References: <1238539254.15350.554.camel@voxel> In-Reply-To: <1238539254.15350.554.camel@voxel> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Nolan wrote: > qcow2's get_cluster_offset() scans forward in the l2 table to find other > clusters that have the same allocation status as the first cluster. > This is used by (among others) qcow_is_allocated(). > > Unfortunately, it was not checking to be sure that it didn't fall off > the end of the l2 table. This patch adds that check. > > The symptom that motivated me to look into this was that > bdrv_is_allocated() was returning false when there was in fact data > there. This is one of many ways this bug could lead to data corruption. > > I checked the other place that scans for consecutive unallocated blocks > (alloc_cluster_offset()) and it appears to be OK: > nb_clusters = MIN(nb_clusters, s->l2_size - l2_index); > appears to prevent the same problem from occurring. > > Signed-off-by: Nolan Leake sigbus.net> > Applied to stable. Thanks -- Regards, Anthony Liguori