This series is a followup to my previous patch sent under
"qcow2: add very final sync on QCOW2 image closing". Could be considered
as v2.

This series addresses two problems:
1. bdrv_co_flush() at the end of bdrv_driver_pwritev() and
   bdrv_co_do_pwrite_zeroes() could be effectively no op. The problem is
   that bdrv_co_flush() is optimized internally this way to track real
   requests which were making changes in the image and without such
   requests from previous flush() do nothing. Requests are tracked using
   write_gen on BDS. This field should be incremented after write is
   completed but before flush is called.

   This could be considered as potential data loss if caller relies on
   BDRV_REQ_FUA flag which means that such requests are really lands on
   the underlying device, which could not due to missed flush().

2. qcow2_update_header() must actually write header with BDRV_REQ_FUA
   flag as image processing on open relies on the fact that header is
   actual and it is not possible to reorder header modifications and
   image content modifications.

Changes:
    * added patches 1 & 2

Signed-off-by: Denis V. Lunev <[email protected]>
CC: Andrey Drobyshev <[email protected]>
CC: Kevin Wolf <[email protected]>
CC: Hanna Reitz <[email protected]>


Reply via email to