mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
qcow2: Fix alloc_cluster_abort() for pre-existing clusters
handle_alloc() reuses preallocated zero clusters. If anything goes
wrong during the data write, we do not change their L2 entry, so we
must not let qcow2_alloc_cluster_abort() free them.
Fixes: 8b24cd1415
Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200225143130.111267-2-mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
f4c4357fbf
commit
3ede935fdb
1 changed files with 1 additions and 1 deletions
|
@ -1026,7 +1026,7 @@ err:
|
||||||
void qcow2_alloc_cluster_abort(BlockDriverState *bs, QCowL2Meta *m)
|
void qcow2_alloc_cluster_abort(BlockDriverState *bs, QCowL2Meta *m)
|
||||||
{
|
{
|
||||||
BDRVQcow2State *s = bs->opaque;
|
BDRVQcow2State *s = bs->opaque;
|
||||||
if (!has_data_file(bs)) {
|
if (!has_data_file(bs) && !m->keep_old_clusters) {
|
||||||
qcow2_free_clusters(bs, m->alloc_offset,
|
qcow2_free_clusters(bs, m->alloc_offset,
|
||||||
m->nb_clusters << s->cluster_bits,
|
m->nb_clusters << s->cluster_bits,
|
||||||
QCOW2_DISCARD_NEVER);
|
QCOW2_DISCARD_NEVER);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue