[PATCH v4 0/4] qcow2: don't leave partially initialized file on image creation

Maxim Levitsky posted 4 patches 3 years, 4 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20201209164441.867945-1-mlevitsk@redhat.com
Maintainers: Max Reitz <mreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>
There is a newer version of this series
block.c               | 23 +++++++++++++++++++++++
block/crypto.c        | 13 ++-----------
block/qcow2.c         |  7 ++++---
include/block/block.h |  1 +
4 files changed, 30 insertions(+), 14 deletions(-)
[PATCH v4 0/4] qcow2: don't leave partially initialized file on image creation
Posted by Maxim Levitsky 3 years, 4 months ago
Use the bdrv_co_delete_file interface to delete the underlying
file if qcow2 initialization fails (e.g due to bad encryption secret)

This makes the qcow2 driver behave the same way as the luks driver behaves.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1845353

V3: addressed review feedback and reworked commit messages

V4: got rid of code duplication by adding bdrv_co_delete_file_noerr
and made the qcow2 driver use this function to delete
both the main and the data file.

Best regards,
	Maxim Levitsky

Maxim Levitsky (4):
  crypto: luks: Fix tiny memory leak
  block: add bdrv_co_delete_file_noerr
  crypto: luks: use bdrv_co_delete_file_noerr
  block: qcow2: remove the created file on initialization error

 block.c               | 23 +++++++++++++++++++++++
 block/crypto.c        | 13 ++-----------
 block/qcow2.c         |  7 ++++---
 include/block/block.h |  1 +
 4 files changed, 30 insertions(+), 14 deletions(-)

-- 
2.26.2