[Devel] [PATCH hci-8.1 3/3] dm-ploop: fail writes to a read-only device
no-reply at sashiko.virtuozzo.com
no-reply at sashiko.virtuozzo.com
Mon Nov 9 22:19:18 MSK 2026
> From: Denis V. Lunev <den at openvz.org>
>
> 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 <denis.genov at virtuozzo.com>
> Feature: dm-ploop: ploop target driver
> Signed-off-by: Denis V. Lunev <den at openvz.org>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261109190604.1850504-1-den@openvz.org?part=3
More information about the Devel
mailing list