OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: Alexander Ivanov <alexander.ivanov@virtuozzo.com>,
	andrey.zhadchenko@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 1/3] drivers/md/dm-qcow2: treat images of a read-only table as read-only
Date: Thu, 29 Oct 2026 12:36:55 +0100	[thread overview]
Message-ID: <9364a9cf-e923-4b65-b317-497aae449c6b@virtuozzo.com> (raw)
In-Reply-To: <20261023132008.2304901-2-alexander.ivanov@virtuozzo.com>

> then dm-qcow2 truncates the unaligned image tail on every .ctr and
> .preresume and considers the image writable on the I/O and discard
> paths.

then dm-qcow2 pads the unaligned image tail on .ctr and .preresume and
considers the image writable on the discard and merge paths.

qcow2_truncate_safe() extends the file to PAGE_ALIGN(file_size), it
cuts nothing, and only while the tail is unaligned. The plain write
path never consults qcow2_file_is_writable(), it goes through
qio_may_modify_image(), which is true for every non-merge qio; the
helper gates only discard, prepare_backward_merge(), the merge
read-ahead and the header/padding sites.

> -             mode = qcow2->file->f_mode;
> -             if (pos == qcow2->file_size && !(mode & FMODE_WRITE)) {
> +             if (pos == qcow2->file_size && !qcow2_file_is_writable(qcow2)) {

Optional, while you are here: the comment above, "Read near EOF? See
qcow2_attach_file()", points at the wrong function. The padding that
makes a short read possible is in qcow2_parse_header().

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  parent reply	other threads:[~2026-10-29 11:38 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 [this message]
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 ` [Devel] [PATCH hci-8.1 3/3] drivers/md/dm-qcow2: do not revalidate inconsistent persistent bitmaps Alexander Ivanov
2026-10-23 13:25   ` 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=9364a9cf-e923-4b65-b317-497aae449c6b@virtuozzo.com \
    --to=khorenko@virtuozzo.com \
    --cc=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