> From: Denis V. Lunev <[email protected]>
> 
> bio_check_ro() only warns about a write to a read-only disk and lets it
> through, and ploop_clone_and_map() passes it on into the mapping code
> as on a writable device. Such a write comes from a device stacked on
> top, e.g. the partition device that partprobe creates over a ploop
> device; a userspace write to the ploop device itself gets EPERM.
> 
> Userspace opens the deltas of a read-only table read-only, but the data
> of a pio goes to the file through f_op->write_iter() directly, which
> does not check FMODE_WRITE, so it reaches the image. Allocating a cluster
> punches or zeroes it with vfs_fallocate(), which does, and fails with
> EBADF, so part of such a write fails with an I/O error and the rest
> changes the read-only image.
> 
> Kill write requests of a read-only table in ploop_clone_and_map(), as
> dm-qcow2 does since commit 409d7e697578
> ("drivers/md/dm-qcow2: fail writes to a read-only table"). The write
> fails at once with an I/O error and the image stays untouched. Flushes
> still pass.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-154096
> 
> Reported-by: Denis Genov <[email protected]>
> Feature: dm-ploop: ploop target driver
> Signed-off-by: Denis V. Lunev <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review ยท 
https://sashiko.vzint.dev/#/patchset/[email protected]?part=3


_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to