Skip to content

fix potential data loss in QEMU (missed flush)

Denis V. Lunev via qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 6 repliesIn review

Changes from the cover letter

* added patches 1 & 2

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3block: create bdrv_advance_flush_gen() helperblock/io.c include/block/block_int-common.h+6 -11 reply
2/3block: move bdrv_advance_flush_gen() earlier from bdrv_co_write_req_finishblock/io.c+13 -62 replies
3/3qcow2: add very final sync on QCOW2 image closingblock/qcow2.c+1 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] fix potential data loss in QEMU (missed flush)

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

CC Andrey Drobyshev <[email protected]>
CC Kevin Wolf <[email protected]>
CC Hanna Reitz <[email protected]>