From: no-reply@sashiko.virtuozzo.com
To: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>,
khorenko@virtuozzo.com, alexander.ivanov@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v3 5/8] dm-qcow2: implement per-qio fast processing
Date: Fri, 13 Nov 2026 11:31:46 +0000 [thread overview]
Message-ID: <010701a1d4ad8f68-dd362e57-1544-4a26-b62f-63b07e254066-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261113111126.793039-6-andrey.zhadchenko@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] dm-qcow2: unpinned fast-path reads can hit a freed and reused
cluster
--
commit d4a94f4cb8fd390d1180cc72ba95c9cab302fcdc
Author: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
dm-qcow2: implement per-qio fast processing
This commit tries to process each qio right after it is split, in the per-qio work. Qios that still need metadata work go back onto the deferred list for the main kwork.
> diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
> index 496fbcc61348..fb2a1c7c4211 100644
> --- a/drivers/md/dm-qcow2-map.c
> +++ b/drivers/md/dm-qcow2-map.c
> @@ -4817,9 +4817,18 @@ static void handle_cleanup_mask(struct qio *qio)
> }
> }
>
> +static void qio_try_fast(struct qio *qio, struct list_head *deferred_qios)
> +{
> + list_del(&qio->link);
> +
> + if (process_one_qio(qio->qcow2, qio, true))
> + list_add_tail(&qio->link, deferred_qios);
> +}
> +
[Severity: Medium]
As reported by Konstantin Khorenko on v2 [1], can a fast-path read hit a cluster that has been freed and reused?
qio_try_fast() runs process_one_qio() in parallel with the main kwork. For a read, parse_metadata() takes the data cluster position from the L2 entry and then drops md_pages_lock. It does not pin the cluster, because inc_writers() is only called for writes and partial discards. process_read_qio() then calls perform_rw_mapped(..., false) against that stale position, with no revalidation.
If the fast worker stalls between the parse and the submit, the main kwork can discard the cluster, write back the L2 entry and free the cluster. It can then hand the cluster to another allocation. The read then returns data belonging to a different guest offset. If another consumer reuses the cluster, this also leaks that consumer's data.
The commit message documents this and defers the fix to VSTOR-154659. The race still ships with this patch, and nothing later in the series adds read pinning.
[1] https://lore.kernel.org/r/179433339615.3573054.12995587619826112869.b4-review@b4
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261113111126.793039-1-andrey.zhadchenko@virtuozzo.com?part=5
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-13 11:34 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 11:11 [Devel] [PATCH hci-8.1 v3 0/8] dm-qcow2: per-qio fast path Andrey Zhadchenko
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 1/8] dm-qcow2: repeat md page lookup if it was inserted in parallel Andrey Zhadchenko
2026-11-13 11:22 ` no-reply
2026-11-13 19:48 ` Konstantin Khorenko
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 2/8] dm-qcow2: prepare process_one_qio() for fastpath Andrey Zhadchenko
2026-11-13 11:26 ` no-reply
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 3/8] dm-qcow2: count fast path writes in parse_metadata() Andrey Zhadchenko
2026-11-13 11:27 ` no-reply
2026-11-13 19:48 ` Konstantin Khorenko
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 4/8] dm-qcow2: add per-qio work infrastructure Andrey Zhadchenko
2026-11-13 11:30 ` no-reply
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 5/8] dm-qcow2: implement per-qio fast processing Andrey Zhadchenko
2026-11-13 11:31 ` no-reply [this message]
2026-11-13 19:48 ` Konstantin Khorenko
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 6/8] dm-qcow2: add fast_path module parameter Andrey Zhadchenko
2026-11-13 11:31 ` no-reply
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 7/8] dm-qcow2: process fast path qios in per-cpu batches on a workqueue Andrey Zhadchenko
2026-11-13 11:33 ` no-reply
2026-11-13 19:48 ` Konstantin Khorenko
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 8/8] dm-qcow2: declare DM_TARGET_NOWAIT Andrey Zhadchenko
2026-11-13 11:33 ` no-reply
2026-11-13 19:48 ` [Devel] [PATCH hci-8.1 v3 0/8] dm-qcow2: per-qio fast path Konstantin Khorenko
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=010701a1d4ad8f68-dd362e57-1544-4a26-b62f-63b07e254066-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=alexander.ivanov@virtuozzo.com \
--cc=andrey.zhadchenko@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
/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