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

Alexander Ivanov alexander.ivanov at virtuozzo.com
Mon Nov 9 13:32:19 MSK 2026


Fixed in v10: the comment now requires that nobody else looks
the page up until the helper returns, and says why (a qio queued
on md->wait_list is never woken and is freed with the page on read
error). *md is set to NULL on both error paths.

On 11/3/26 18:50, Konstantin Khorenko wrote:
> 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.
>


More information about the Devel mailing list