|
|
8fced6 |
From bd97bbbce54da301407d51cae35e09ba2a12b160 Mon Sep 17 00:00:00 2001
|
|
|
8fced6 |
From: Max Reitz <mreitz@redhat.com>
|
|
|
8fced6 |
Date: Mon, 13 Jul 2020 14:24:48 -0400
|
|
|
8fced6 |
Subject: [PATCH 1/4] qcow2: Fix alloc_cluster_abort() for pre-existing
|
|
|
8fced6 |
clusters
|
|
|
8fced6 |
|
|
|
8fced6 |
RH-Author: Max Reitz <mreitz@redhat.com>
|
|
|
8fced6 |
Message-id: <20200713142451.289703-2-mreitz@redhat.com>
|
|
|
8fced6 |
Patchwork-id: 97954
|
|
|
8fced6 |
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 1/4] qcow2: Fix alloc_cluster_abort() for pre-existing clusters
|
|
|
8fced6 |
Bugzilla: 1807057
|
|
|
8fced6 |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
8fced6 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
8fced6 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
8fced6 |
|
|
|
8fced6 |
handle_alloc() reuses preallocated zero clusters. If anything goes
|
|
|
8fced6 |
wrong during the data write, we do not change their L2 entry, so we
|
|
|
8fced6 |
must not let qcow2_alloc_cluster_abort() free them.
|
|
|
8fced6 |
|
|
|
8fced6 |
Fixes: 8b24cd141549b5b264baeddd4e72902cfb5de23b
|
|
|
8fced6 |
Cc: qemu-stable@nongnu.org
|
|
|
8fced6 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
8fced6 |
Message-Id: <20200225143130.111267-2-mreitz@redhat.com>
|
|
|
8fced6 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
8fced6 |
(cherry picked from commit 3ede935fdbbd5f7b24b4724bbfb8938acb5956d8)
|
|
|
8fced6 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
8fced6 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
8fced6 |
---
|
|
|
8fced6 |
block/qcow2-cluster.c | 2 +-
|
|
|
8fced6 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
8fced6 |
|
|
|
8fced6 |
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
|
|
|
8fced6 |
index 9d04f8d77b..1970797ce5 100644
|
|
|
8fced6 |
--- a/block/qcow2-cluster.c
|
|
|
8fced6 |
+++ b/block/qcow2-cluster.c
|
|
|
8fced6 |
@@ -1015,7 +1015,7 @@ err:
|
|
|
8fced6 |
void qcow2_alloc_cluster_abort(BlockDriverState *bs, QCowL2Meta *m)
|
|
|
8fced6 |
{
|
|
|
8fced6 |
BDRVQcow2State *s = bs->opaque;
|
|
|
8fced6 |
- if (!has_data_file(bs)) {
|
|
|
8fced6 |
+ if (!has_data_file(bs) && !m->keep_old_clusters) {
|
|
|
8fced6 |
qcow2_free_clusters(bs, m->alloc_offset,
|
|
|
8fced6 |
m->nb_clusters << s->cluster_bits,
|
|
|
8fced6 |
QCOW2_DISCARD_NEVER);
|
|
|
8fced6 |
--
|
|
|
8fced6 |
2.27.0
|
|
|
8fced6 |
|