qemu-kvm/kvm-qcow2-Fix-qcow2_alloc_cluster_abort-for-external-dat.patch
Danilo C. L. de Paula 2084aa0246 * Sat Feb 29 2020 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 4.2.0-13.el8
- kvm-target-i386-kvm-initialize-feature-MSRs-very-early.patch [bz#1791648]
- kvm-target-i386-add-a-ucode-rev-property.patch [bz#1791648]
- kvm-target-i386-kvm-initialize-microcode-revision-from-K.patch [bz#1791648]
- kvm-target-i386-fix-TCG-UCODE_REV-access.patch [bz#1791648]
- kvm-target-i386-check-for-availability-of-MSR_IA32_UCODE.patch [bz#1791648]
- kvm-target-i386-enable-monitor-and-ucode-revision-with-c.patch [bz#1791648]
- kvm-qcow2-Fix-qcow2_alloc_cluster_abort-for-external-dat.patch [bz#1703907]
- kvm-mirror-Store-MirrorOp.co-for-debuggability.patch [bz#1794692]
- kvm-mirror-Don-t-let-an-operation-wait-for-itself.patch [bz#1794692]
- Resolves: bz#1703907
  ([upstream]QEMU coredump when converting to qcow2: external data file images on block devices with copy_offloading)
- Resolves: bz#1791648
  ([RFE] Passthrough host CPU microcode version to KVM guest if using CPU passthrough)
- Resolves: bz#1794692
  (Mirror block job stops making progress)
2020-02-29 03:50:42 +00:00

53 lines
1.9 KiB
Diff

From ecc4fb6e1941035e1d9def1f69b779fbea216caf Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Mon, 24 Feb 2020 16:13:07 +0000
Subject: [PATCH 7/9] qcow2: Fix qcow2_alloc_cluster_abort() for external data
file
RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <20200224161307.29783-2-kwolf@redhat.com>
Patchwork-id: 94042
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 1/1] qcow2: Fix qcow2_alloc_cluster_abort() for external data file
Bugzilla: 1703907
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Max Reitz <mreitz@redhat.com>
For external data file, cluster allocations return an offset in the data
file and are not refcounted. In this case, there is nothing to do for
qcow2_alloc_cluster_abort(). Freeing the same offset in the qcow2 file
is wrong and causes crashes in the better case or image corruption in
the worse case.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200211094900.17315-3-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit c3b6658c1a5a3fb24d6c27b2594cf86146f75b22)
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
block/qcow2-cluster.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 8982b7b..dc3c270 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -1015,8 +1015,11 @@ err:
void qcow2_alloc_cluster_abort(BlockDriverState *bs, QCowL2Meta *m)
{
BDRVQcow2State *s = bs->opaque;
- qcow2_free_clusters(bs, m->alloc_offset, m->nb_clusters << s->cluster_bits,
- QCOW2_DISCARD_NEVER);
+ if (!has_data_file(bs)) {
+ qcow2_free_clusters(bs, m->alloc_offset,
+ m->nb_clusters << s->cluster_bits,
+ QCOW2_DISCARD_NEVER);
+ }
}
/*
--
1.8.3.1