Skip to content

block/drive-mirror: Check for NULL backing_hd

Max Reitz qemu-devel 3 versions – Applied

Status from this message: Thanks, applied to the block branch.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 5 repliesApplied
  2. v22 patches 5 repliesSuperseded
  3. v11 of 2 patches 1 replySuperseded

v2 from the cover letter

- patch 1: Reuse an already existing codepath to create an unbacked target image instead of introducing a new one (based on Fam's comment).
- patch 2: Incorporated test case into 041 instead of creating a new file (according to Xia's and Paolo's comments).

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/2block/drive-mirror: Check for NULL backing_hdblockdev.c+3 -11 reply
2/2qemu-iotests: Extend 041 for unbacked mirroringtests/qemu-iotests/041 tests/qemu-iotests/041.out+27 -21 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchEric BlakeWenchao XiaPaolo Bonzini
SeriesR-b
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [Qemu-devel] [PATCH v3 0/2] block/drive-mirror: Check for NULL backing_hd

It should be possible to execute the QMP "drive-mirror" command in "none" sync mode and "absolute-paths" mode even for block devices lacking a backing file.

"absolute-paths" does in fact not require a backing file to be present, as can be seen from the "top" sync mode code path. "top" basically states that the device should indeed have a backing file - however, the current code catches the case if it doesn't and then simply treats it as "full" sync mode, creating a target image without a backing file (in "absolute-paths" mode). Thus, "absolute-paths" does not imply the target file must indeed have a backing file.

Therefore, the target file may be left unbacked in case of "none" sync mode as well, if the specified device is not backed either. Currently, qemu will crash trying to dereference the backing file pointer since it assumes that it will always be non-NULL in that case ("none" with "absolute-paths").

The first patch in this series adds a check whether the specified block device is backed or not (creating an unbacked target image, if required); the second patch adds a test case for mirroring unbacked block devices.

v2:
- patch 1: Reuse an already existing codepath to create an unbacked target image instead of introducing a new one (based on Fam's comment).
- patch 2: Incorporated test case into 041 instead of creating a new file (according to Xia's and Paolo's comments).

Max Reitz (2):
block/drive-mirror: Check for NULL backing_hd
qemu-iotests: Extend 041 for unbacked mirroring

 blockdev.c                 |  4 +++-
 tests/qemu-iotests/041     | 25 +++++++++++++++++++++++++
 tests/qemu-iotests/041.out |  4 ++--
 3 files changed, 30 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.4.2