[Devel] [PATCH hci-8.2] dm-qcow2: fix a short image read resubmitted at the wrong sector
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Nov 19 19:39:41 MSK 2026
Applying, after the read livelock v2 series, with these fixes on my
side:
- "A read-only image whose file ends inside a sector" -> "A truncated
or otherwise damaged read-only image whose file ends inside a sector".
- "which would rewrite good bytes at the rounded-down offset" -> "whose
resubmit would put the rest of the data below where it belongs".
On Thu, 19 Nov 2026 15:29:56 +0100, Denis V. Lunev wrote:
> A read-only image whose file ends inside a sector and a page or more
> short of the read gets such a read. On ext4 or xfs the O_DIRECT
A well-formed image never gets there: a compressed cluster at EOF is
read up to the next page, so less than a page is missing and it is
zero-filled; a plain cluster ends on a sector. Only an L2 entry that
points past the end of a truncated file does it.
> which would rewrite good bytes at the rounded-down offset, instead of
> resubmitting it.
The resubmitted write puts buf[ret..] at pos + round_down(ret, 512):
every remaining byte lands (ret & 511) bytes too low, and the last
(ret & 511) bytes of the range are never written.
Separate patches, not needed for this one. I created a task:
1. A write that returns 0 bytes still hits WARN_ON_ONCE() and is
resubmitted unchanged, forever if a FUSE daemon keeps answering 0;
it should fail with -EIO as a read does.
https://virtuozzo.atlassian.net/browse/VSTOR-156109
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
More information about the Devel
mailing list