From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFKCZ-0007vQ-6t for qemu-devel@nongnu.org; Fri, 30 Aug 2013 04:37:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VFKCT-000345-93 for qemu-devel@nongnu.org; Fri, 30 Aug 2013 04:37:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60797) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFKCT-00033s-1f for qemu-devel@nongnu.org; Fri, 30 Aug 2013 04:37:01 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7U8b0O2010203 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 30 Aug 2013 04:37:00 -0400 From: Max Reitz Date: Fri, 30 Aug 2013 10:36:42 +0200 Message-Id: <1377851804-13614-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v2 0/2] qcow2: Snapshot update for zero clusters List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , Max Reitz When creating a snapshots, the refcount adjustment function basically adjusted the refcounts of any cluster with a non-zero L2 entry. However, the L2 entry of unallocated zero clusters is exactly one (therefore non-zero) which led to wrong refcount updates on cluster 0 (the main qcow2 header), since the cluster index for these unallocated zero clusters is 0. This series fixes this by taking all cluster types specifically into account using qcow2_get_cluster_type and handling them accordingly. Furthermore, a short test is added. v2: - more thorough commit message - take pre-allocated zero clusters into account - abort on unknown cluster type - a test case Max Reitz (2): qcow2-refcount: Snapshot update for zero clusters qemu-iotests: Snapshotting zero clusters block/qcow2-refcount.c | 52 ++++++++++++++++++++++++++------------- tests/qemu-iotests/062 | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 100 insertions(+), 17 deletions(-) create mode 100755 tests/qemu-iotests/062 -- 1.8.3.1