[Devel] [PATCH hci-8.1 v2 1/3] drivers/md/dm-qcow2: treat images of a read-only table as read-only

no-reply at sashiko.virtuozzo.com no-reply at sashiko.virtuozzo.com
Thu Oct 29 17:48:10 MSK 2026


> Whether an image may be modified is decided by the mode of its file
> only. Userspace may pass an O_RDWR top image to a read-only table, and
> then dm-qcow2 pads the unaligned image tail on .ctr and .preresume and
> considers the image writable on the discard and merge paths.
> 
> merge_backward is also allowed on a read-only table if the lower image
> is opened for write. qcow2_set_image_file_features() checks the table
> mode and skips the lower image, so the merge writes to it without the
> dirty bit and without clearing the bitmaps autoclear bit. Enabled
> persistent bitmaps of the lower image are left marked consistent
> although the image data changed.
> 
> Consider an image writable only if both its file and the table are
> writable, and use this check for the header update, the tail padding
> and the short read near EOF as well. merge_backward on a read-only
> table now fails with -EACCES.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-138887
> Feature: dm-qcow2: block device over QCOW2 files driver
> 
> Signed-off-by: Alexander Ivanov <alexander.ivanov at virtuozzo.com>

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

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261029144358.3384569-1-alexander.ivanov@virtuozzo.com?part=1




More information about the Devel mailing list