[Devel] [PATCH hci-8.1 v9 01/10] dm-qcow2: add qcow2_md_page_read_sync() helper

Konstantin Khorenko khorenko at virtuozzo.com
Tue Nov 3 20:50:49 MSK 2026


I won't apply this version, please send v10 with the changes below.

On 10/28/26 16:06, Alexander Ivanov wrote:
> + * The caller must ensure no read of this page is in flight
> + * (e.g., the device is suspended): if the page is cached but
> + * not MD_UPTODATE yet, qcow2_md_page_find_or_postpone() returns
> + * NULL and the following insert fails.

- Require "no concurrent lookup of this page" in the comment.
- Set *md = NULL on both error paths.

These are my v5 remarks, v9 has neither.

A qio that looks the page up before MD_UPTODATE is set waits on
md->wait_list. This helper never wakes it, and on a read error it frees
the page with the qio still queued. So a read in flight is not the only
thing the caller must exclude.

On a read error, and on -EEXIST from qcow2_alloc_and_insert_md_page(),
*md points to freed memory. No caller uses it today, but the next one
will not expect that.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team



More information about the Devel mailing list