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

Maxim Levitsky posted 3 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/20201217170904.946013-1-mlevitsk@redhat.com
Maintainers: Max Reitz <mreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>
block.c               | 22 ++++++++++++++++++++++
block/crypto.c        | 13 ++-----------
block/qcow2.c         |  8 +++++---
include/block/block.h |  1 +
4 files changed, 30 insertions(+), 14 deletions(-)
[PATCH v6 0/3] 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.

V5: addresssed review feedback on reworked version.

V6: addressed most of the review feedback.

Best regards,
	Maxim Levitsky

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

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

-- 
2.26.2



Re: [PATCH v6 0/3] qcow2: don't leave partially initialized file on image creation
Posted by Maxim Levitsky 3 years, 3 months ago
On Thu, 2020-12-17 at 19:09 +0200, Maxim Levitsky wrote:
> 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.
> 
> V5: addresssed review feedback on reworked version.
> 
> V6: addressed most of the review feedback.
> 
> Best regards,
> 	Maxim Levitsky
> 
> Maxim Levitsky (3):
>   crypto: luks: Fix tiny memory leak
>   block: add bdrv_co_delete_file_noerr
>   block: qcow2: remove the created file on initialization error
> 
>  block.c               | 22 ++++++++++++++++++++++
>  block/crypto.c        | 13 ++-----------
>  block/qcow2.c         |  8 +++++---
>  include/block/block.h |  1 +
>  4 files changed, 30 insertions(+), 14 deletions(-)
> 
> -- 
> 2.26.2
> 
> 
> 
Any update on this?

Best regards,
	Maxim Levitsky


Re: [PATCH v6 0/3] qcow2: don't leave partially initialized file on image creation
Posted by Kevin Wolf 3 years, 2 months ago
Am 17.12.2020 um 18:09 hat Maxim Levitsky geschrieben:
> 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.

Thanks, applied to the block branch.

Kevin