Skip to content

qemu-img: Fix check's leak/corruption fix report

Max Reitz qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 3 repliesIn review
  2. v13 patches 6 repliesSuperseded

Changes in v2 from the cover letter

- Patch 2:
- Rewrote the new functions as per Eric’s suggestions (thanks a lot!)
- Changed the functions’ “doc strings” to not just show an example, but perhaps more importantly what each parameter means
- Patch 3:
- Eric said the pre-existing comment explaining why 138 doesn’t supported data_file made it sound like qemu-img check had a bug. I’m sure it does have bugs, but this isn’t one, so I tried to explain it a bit differently.
- Use poke_file_be in another place
- Convert sed | grep | sed to a single sed, as per Eric’s suggestion, and avoid \< and \>

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3qemu-img: Fix check's leak/corruption fix reportqemu-img.c+7 -20 replies
2/3iotests: Add poke_file_[bl]e functionstests/qemu-iotests/common.rc+24 -01 reply
3/3iotests/138: Test leaks/corruptions fixed reporttests/qemu-iotests/138 tests/qemu-iotests/138.out+53 -21 reply

Reviews trailers per patch

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

PatchEric Blake
1/3R-b
2/3Code-suggested-by R-b
3/3R-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 [PATCH for-5.0 v2 0/3] qemu-img: Fix check's leak/corruption fix report

Branch: https://github.com/XanClic/qemu.git fix-check-result-v2
Branch: https://git.xanclic.moe/XanClic/qemu.git fix-check-result-v2

v1: https://lists.nongnu.org/archive/html/qemu-block/2020-02/msg01418.html

Hi,

While reviewing the “fix two small memleaks” series (<[email protected]>) I noticed that we save ImageCheck.(leaks|corruptions)_fixed from the first run and overwrite the values obtained in the second run (where they must be zero because we do not request any fixes in that second run), but we do not overwrite ImageCheck.has_(leaks|corruptions)_fixed after the second run. That smells fishy.

Furthermore, ImageCheck.has_(leaks|corruptions)_fixed are not set based on whether (leaks|corruptions)_fixed is non-zero, but actually based on whether the leaks and corruptions fields (respectively) are non-zero. qcow2’s check implementation reduces the leaks and corruptions values when it fixes them, because then there are no leaks and corruptions after the check anymore.

All in all, after a successful run, you will not see “qemu-img check --output=json” report corruptions-fixed or leaks-fixed. Which is a shame. So this series fixes that and adds a test to ensure those fields are indeed reported.

v2:
- Patch 2:
- Rewrote the new functions as per Eric’s suggestions (thanks a lot!)
- Changed the functions’ “doc strings” to not just show an example, but perhaps more importantly what each parameter means
- Patch 3:
- Eric said the pre-existing comment explaining why 138 doesn’t supported data_file made it sound like qemu-img check had a bug. I’m sure it does have bugs, but this isn’t one, so I tried to explain it a bit differently.
- Use poke_file_be in another place
- Convert sed | grep | sed to a single sed, as per Eric’s suggestion, and avoid \< and \>

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/3:[----] [--] 'qemu-img: Fix check's leak/corruption fix report' 002/3:[0029] [FC] 'iotests: Add poke_file_[bl]e functions' 003/3:[0008] [FC] 'iotests/138: Test leaks/corruptions fixed report'

Max Reitz (3):
qemu-img: Fix check's leak/corruption fix report
iotests: Add poke_file_[bl]e functions iotests/138: Test leaks/corruptions fixed report

 qemu-img.c                   |  9 ++++++--
 tests/qemu-iotests/138       | 41 ++++++++++++++++++++++++++++++++++--
 tests/qemu-iotests/138.out   | 14 ++++++++++++
 tests/qemu-iotests/common.rc | 24 +++++++++++++++++++++
 4 files changed, 84 insertions(+), 4 deletions(-)
Signature · 1 line
2.25.1