Checking dm-qcow2 for the same problem showed that a merge does not stop everything using the images it changes (VSTOR-153049, VSTOR-153050):
- a backward merge of an inner image starts without pausing anything, while reads enter through the top image. A read reaching the inner image as the merge starts oopses on a NULL qio->ext (patch 2); - SEEK_HOLE/SEEK_DATA walks the images with nothing keeping them alive, so merge_backward complete frees an image under the walk (patch 3). Patch 4 (VSTOR-153422) fixes a seek that sleeps forever after a failed metadata read, which with patch 3 would also hold off the next merge_backward complete and every target message. Patches 1 and 5 fix the refcount table relocation. Patch 1 (VSTOR-153051) is the counterpart of dm-ploop patch 4, an error path leaving state behind: after a failed relocation, allocating writes past the old refcount coverage fail with EIO until the device is suspended and resumed. Patch 5 (VSTOR-153421) fixes a relocation failing on a valid image once the new reftable fills a refcount group by itself, with 4K clusters and refcount_bits=64 at about 511G. The series does not depend on the dm-ploop one. Tested on dev-cl04, stock 6.12.0-211.52.1.22.11.vz10, dm-qcow2 built out of tree: - with a test-only kprobe module widening the windows, on the stock module: with 4K clusters and refcount_bits=64 so the reftable relocates at 1G, a failed md page insert left every later write past 1G failing with EIO; a seek went on with an image qcow2_destroy() had freed; an intermediate merge oopsed in submit_read_sliced_clu(). None of them reproduce with the series; - SEEK_DATA over an image whose backing device starts failing reads returns EIO with patch 4; - an image with a 511-cluster reftable covering 511G and every cluster in use: without patch 5 the first allocating write fails with EIO after a WARN, and qemu-img check then reports 513 errors; with it the writes go through and the check finds no errors; - the ploop pytest suite, qcow2 format, passes. Changes in v3, after Konstantin's review: - 1/5: once the header write has succeeded, the error paths only return -EIO and leave the new md pages alone, as they may already be dirty and queued for writeback. The commit message says so in place of the note; - 2/5: "no guest writes" in the comment, and the message says that starting or stopping a merge of an inner image now pauses guest I/O to the top image for the inflight ref switch; - 3/5: the message says that merge_backward complete now waits for a running seek while it holds ctl_mutex; - 4/5, 5/5: new, the two older bugs found in the review; - rebased on rh10-6.12.0-211.52.1.22.17.vz10, Reviewed-by tags added to 2/5 and 3/5; Andrey's on 1/5 is dropped, as its code changed. v2: http://lore.virtuozzo.com/kernel/[email protected]/ v1: http://lore.virtuozzo.com/kernel/[email protected]/ Denis V. Lunev (5): dm-qcow2: fix a failed refcount table relocation leaking md pages dm-qcow2: fix backward merge of an inner image racing its reads dm-qcow2: fix SEEK_HOLE/SEEK_DATA using an image freed by a merge dm-qcow2: fix SEEK_HOLE/SEEK_DATA hanging after a failed metadata read dm-qcow2: fix a refcount table relocation failing on a valid image drivers/md/dm-qcow2-cmd.c | 28 ++++++++----------- drivers/md/dm-qcow2-map.c | 53 ++++++++++++++++++++++++++---------- drivers/md/dm-qcow2-target.c | 1 + drivers/md/dm-qcow2.h | 2 ++ 4 files changed, 54 insertions(+), 30 deletions(-) base-commit: 95ab11e2c57e8468412ca586d4be8cd75b6bfbf0 -- 2.53.0 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
