I won't apply this version, please send v3 with the changes below.
On Tue, 10 Nov 2026 14:46:24 +0300, Andrey Zhadchenko wrote:
> + if (__delay_if_writeback(qcow2, md, index_in_page, &qio,
> false)) {
> + spin_unlock_irqrestore(&qcow2->md_pages_lock, flags);
> + return;
> + }
Item 1 of the cover letter reply: under this lock also check that the
L2 entry (and the ext_l2 word) is what parse_l2() saw and that the
index is not locked; if not, hand the qio back to main kwork.
Why: a failed L2 writeback can complete before the fast worker gets
here. complete_wbd() then reverts the entry and clears both
MD_WRITEBACK and md->wbd, so this code sees neither DIRTY nor
WRITEBACK. The write goes to X untracked and is acked, while X is no
longer mapped: the data is lost. In main kwork the write was attached
to the wbd in the same pass and got the error. The same recheck also
catches a discard that has already changed the entry (item 3).
> acked and flushed. If the L2 write fails instead, the entry is
> reverted and X freed while the write already returned success.
Item 1 of the cover letter reply: "X freed" becomes "X leaked".
Why: complete_wbd() clears FREE_ALLOCATED_CLU of the allocating qio,
so X stays allocated and unmapped. That wording came from my v1 reply,
sorry. Also, md->wbd is dropped in complete_wbd() from the fsync work,
not only by main kwork as the first paragraph says.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel