A write that reaches a read-only ploop device never completes: the writer hangs in D state, and after a buffered write every later sync on the host hangs behind it until a reboot. Such writes come from a device stacked on top. libploop leaves the partition of "ploop mount -r" writable, which the ploop side fixes in openvz/ploop.ovz PR 513, and libvzctl attaches a backup disk to a Container that way and mounts it read-write (VSTOR-154096).
Two bugs meet there: - when a cluster allocation or a discard fails, the pios parked on that BAT page are never resubmitted (patch 2). Any failing allocation leaves them stuck, not only one on a read-only device. Patch 1 moves the resubmission loop into a helper for it; - dm-ploop does not refuse writes to a read-only table, as dm-qcow2 does since 409d7e697578 (patch 3). The data of such a write reaches the image through f_op->write_iter(), while the allocation of a new cluster fails with EBADF and lands in the bug of patch 2. Tested on 6.12.0-211.52.1.22.19.vz10, dm-ploop built out of tree: - read-only ploop image, its partition mounted read-write, dd of 16M with conv=fsync. Stock: the writer and sync stuck in D state until a reboot, 12 writes in flight, the image changed. Patches 1-2: the fsync fails with EIO, nothing hangs, the image still changes. The whole series: the mount fails on its first superblock write, nothing hangs, the image is unchanged; - ploop test suite, make -j48 test on dev-cl04, green for ploop and qcow2 with this series together with the VSTOR-154182 one. Its new test overwrites a block through a linear device stacked on a read-only device: it fails on stock and passes with both series. Denis V. Lunev (3): dm-ploop: factor out ploop_dispatch_md_waiters() dm-ploop: fix pios stuck in md->wait_llist after a failed BAT update dm-ploop: fail writes to a read-only device drivers/md/dm-ploop-map.c | 41 ++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) -- 2.53.0 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
