]> git.proxmox.com Git - mirror_qemu.git/commit
qcow2: keep reference on zeroize with discard-no-unref enabled
authorJean-Louis Dupond <jean-louis@dupond.be>
Tue, 3 Oct 2023 12:52:37 +0000 (14:52 +0200)
committerHanna Czenczek <hreitz@redhat.com>
Mon, 6 Nov 2023 15:15:07 +0000 (16:15 +0100)
commitb2b109041ecd1095384f5be5bb9badd13c1cf286
tree3c6cc355936a8c74e356a86bc3b3526d0def0bc4
parent3e01f1147a16ca566694b97eafc941d62fa1e8d8
qcow2: keep reference on zeroize with discard-no-unref enabled

When the discard-no-unref flag is enabled, we keep the reference for
normal discard requests.
But when a discard is executed on a snapshot/qcow2 image with backing,
the discards are saved as zero clusters in the snapshot image.

When committing the snapshot to the backing file, not
discard_in_l2_slice is called but zero_in_l2_slice. Which did not had
any logic to keep the reference when discard-no-unref is enabled.

Therefor we add logic in the zero_in_l2_slice call to keep the reference
on commit.

Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1621
Signed-off-by: Jean-Louis Dupond <jean-louis@dupond.be>
Message-Id: <20231003125236.216473-2-jean-louis@dupond.be>
[hreitz: Made the documentation change more verbose, as discussed
         on-list]
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
block/qcow2-cluster.c
qapi/block-core.json
qemu-options.hx