If a write request on a qcow2 image spans more than one L2 table, qcow2_alloc_cluster_offset cannot allocate the required clusters in a single operation. This results in leaks, if a subsequent (atomic) allocation in that function fails, because qcow2_co_writev does not undo unused cluster allocations.
This series implements that deallocation and provides a test for it. v2: - patch 1: added a comment about the significance of future changes at a certain point in qcow2_co_writev - patch 1: changed QCOW2_DISCARD_ALWAYS to QCOW2_DISCARD_OTHER Max Reitz (2): qcow2: Undo leaked allocations in co_writev qemu-iotests: Extend test 026 block/qcow2.c | 15 +++++++++++++++ tests/qemu-iotests/026 | 31 +++++++++++++++++++++++++++++++ tests/qemu-iotests/026.out | 8 ++++++++ tests/qemu-iotests/026.out.nocache | 8 ++++++++ 4 files changed, 62 insertions(+) -- 1.8.3.1