From: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
To: andrey.zhadchenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 3/3] drivers/md/dm-qcow2: do not revalidate inconsistent persistent bitmaps
Date: Fri, 23 Oct 2026 15:20:08 +0200 [thread overview]
Message-ID: <20261023132008.2304901-4-alexander.ivanov@virtuozzo.com> (raw)
In-Reply-To: <20261023132008.2304901-1-alexander.ivanov@virtuozzo.com>
qcow2_check_convert_hdr() ignores the autoclear features stored in the
image, and qcow2_parse_bitmap_ext() sets the bitmaps bit whenever no
bitmap has the auto flag. If the bit was already clear on disk, a
writable open sets it again and marks the bitmaps extension consistent.
The qcow2 spec requires to treat such an extension as inconsistent,
since a program without bitmap support might have modified the image.
Keep the bitmaps bit only if it is set in the image.
https://virtuozzo.atlassian.net/browse/VSTOR-138887
Feature: dm-qcow2: block device over QCOW2 files driver
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
---
drivers/md/dm-qcow2-target.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c
index 2d1e5d4e1b3a..0285427dd795 100644
--- a/drivers/md/dm-qcow2-target.c
+++ b/drivers/md/dm-qcow2-target.c
@@ -835,6 +835,7 @@ static int qcow2_parse_header(struct dm_target *ti, struct qcow2 *qcow2,
struct file *file = qcow2->file;
loff_t ext_start, ext_end;
struct md_page *md;
+ u64 raw_autoclear;
int ret;
qcow2->file_size = i_size_read(file_inode(file));
@@ -865,6 +866,7 @@ static int qcow2_parse_header(struct dm_target *ti, struct qcow2 *qcow2,
max_len = upper->hdr.size;
}
ret = qcow2_check_convert_hdr(ti, raw_hdr, hdr, min_len, max_len);
+ raw_autoclear = be64_to_cpu(raw_hdr->autoclear_features);
kunmap(md->page);
if (ret < 0)
goto out;
@@ -914,6 +916,9 @@ static int qcow2_parse_header(struct dm_target *ti, struct qcow2 *qcow2,
goto out;
}
}
+ /* Bitmaps invalidated before must not become consistent again */
+ if (!(raw_autoclear & QCOW2_AUTOCLEAR_BITMAPS))
+ hdr->autoclear_features &= ~QCOW2_AUTOCLEAR_BITMAPS;
ret = 0;
out:
return ret;
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-10-23 13:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 13:20 [Devel] [PATCH hci-8.1 0/3] dm-qcow2: keep images of a read-only table unmodified Alexander Ivanov
2026-10-23 13:20 ` [Devel] [PATCH hci-8.1 1/3] drivers/md/dm-qcow2: treat images of a read-only table as read-only Alexander Ivanov
2026-10-23 13:24 ` no-reply
2026-10-29 11:36 ` Konstantin Khorenko
2026-10-23 13:20 ` [Devel] [PATCH hci-8.1 2/3] drivers/md/dm-qcow2: fail writes to a read-only table Alexander Ivanov
2026-10-23 13:23 ` no-reply
2026-10-28 10:35 ` Andrey Zhadchenko
2026-10-23 13:20 ` Alexander Ivanov [this message]
2026-10-23 13:25 ` [Devel] [PATCH hci-8.1 3/3] drivers/md/dm-qcow2: do not revalidate inconsistent persistent bitmaps no-reply
2026-10-23 13:58 ` Alexander Ivanov
2026-10-29 11:39 ` Konstantin Khorenko
2026-10-28 10:47 ` [Devel] [PATCH hci-8.1 0/3] dm-qcow2: keep images of a read-only table unmodified Andrey Zhadchenko
2026-10-29 11:42 ` Konstantin Khorenko
2026-10-29 14:48 ` Alexander Ivanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261023132008.2304901-4-alexander.ivanov@virtuozzo.com \
--to=alexander.ivanov@virtuozzo.com \
--cc=andrey.zhadchenko@virtuozzo.com \
--cc=devel@openvz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox