[Devel] [PATCH hci-8.1 v3 1/5] dm-qcow2: fix a failed refcount table relocation leaking md pages

no-reply at sashiko.virtuozzo.com no-reply at sashiko.virtuozzo.com
Wed Nov 4 21:52:54 MSK 2026


> From: Denis V. Lunev <den at openvz.org>
> 
> relocate_refcount_table() inserts md pages for the last cluster of the
> new reftable and for the new refblocks, one page at a time from
> pos + old_clus * clu_size up to r2_end. On error it frees pages from
> end only, one per cluster, so the pages of the new reftable cluster
> and all but the first page of each refblock cluster bigger than a page
> stay in md_pages.
> 
> The header is rolled back, so the next allocation past the old refcount
> coverage relocates the table again. Its first insert finds a leaked page
> and fails with -EEXIST, the relocation returns -EIO, and every
> allocating write beyond the old coverage fails with an I/O error until
> the device is suspended and resumed or the table is reloaded. A failed
> page allocation or a failed header write is enough to get there.
> 
> Free exactly the pages the allocation loop inserted when the relocation
> fails before the header write. Once the header write has succeeded, the
> error paths skip the freeing and only return -EIO: the header on disk
> already points at the new table, and its pages may be dirty and queued
> for writeback by then.
> 
> Fixes: 222b6f1291c1 ("dm-qcow2: Introduce driver to create block devices over QCOW2 files")
> https://virtuozzo.atlassian.net/browse/VSTOR-153051
> Feature: dm-qcow2: block device over QCOW2 files 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/20261104180105.1807820-1-den@openvz.org?part=1




More information about the Devel mailing list