Skip to content

qcow2: Repair OFLAG_COPIED when fixing leaks

Max Reitz qemu-devel 2 versions – Applied

Status from this message: Applied to my block branch.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyApplied
  2. v12 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- Reworded the comment in patch 2 on why the test does not support refcount_bits=1 -- it's not just because of the snapshotting, but mostly because we test OFLAG_COPIED and refcount_bits=1 won't get us far there [Eric]

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2qcow2: Repair OFLAG_COPIED when fixing leaksblock/qcow2-refcount.c+17 -80 replies
2/2iotests: Repairing error during snapshot deletiontests/qemu-iotests/217 tests/qemu-iotests/217.out tests/qemu-iotests/group+133 -00 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchEric Blake
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 0/2] qcow2: Repair OFLAG_COPIED when fixing leaks

Suppose you have an image with consistent OFLAG_COPIED and refcounts. Now further suppose that image has leaked clusters (single reference, but refcount 2). When checking such an image with qemu-img check, it will notify you of the leakage, and that's it.

Now when trying to repair that image, you naturally use -r leaks because that should be sufficient and you want to give qemu-img check just as many "permissions" as it needs so it doesn't destroy your image by accident. But while the qcow2 driver will fix the refcounts, alas! it will now complain about OFLAG_COPIED because that should be set now. However, it will not set that without -r all. So, congratulations, now you have an image that qemu-img check tells you is really corrupted.

This series makes -r leaks fix OFLAG_COPIED as well, but only if repairing the refcounts was completely successful.

There is a Red Hat Bugzilla entry here:
https://bugzilla.redhat.com/show_bug.cgi?id=1527085

...but I'm afraid the bug description is set to confidential, although I don't know why. Sorry. :-/
For everyone who cannot read it, let's say the test case in this series may very well be a good indication of what you don't see.

v2:
- Reworded the comment in patch 2 on why the test does not support refcount_bits=1 -- it's not just because of the snapshotting, but mostly because we test OFLAG_COPIED and refcount_bits=1 won't get us far there [Eric]

git-backport-diff against v1:

Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch [down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/2:[----] [--] 'qcow2: Repair OFLAG_COPIED when fixing leaks' 002/2:[0003] [FC] 'iotests: Repairing error during snapshot deletion'

Max Reitz (2):
qcow2: Repair OFLAG_COPIED when fixing leaks
iotests: Repairing error during snapshot deletion

 block/qcow2-refcount.c     | 25 ++++++++-----
 tests/qemu-iotests/217     | 90 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/217.out | 42 ++++++++++++++++++++++
 tests/qemu-iotests/group   |  1 +
 4 files changed, 150 insertions(+), 8 deletions(-)
 create mode 100755 tests/qemu-iotests/217
 create mode 100644 tests/qemu-iotests/217.out
Signature · 1 line
2.14.3