From: "Denis V. Lunev" <den@openvz.org>
To: andrey.zhadchenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 v2 0/4] dm-ploop: fix acknowledged writes lost when discard and allocation share a BAT writeback
Date: Wed, 28 Oct 2026 15:36:43 +0100 [thread overview]
Message-ID: <20261028143647.2972030-1-den@openvz.org> (raw)
The hci-ploop fstrim test caught dm-ploop losing an acknowledged write
(VSTOR-151979). Since "dm-ploop: fix and rework md updates", an
allocation and a discard on the same BAT page can share one pending
index writeback, and its completion applies the written page by the
writeback's type only. A first write that rides in a DISCARD writeback
is on disk but never reaches the local BAT: it reads back as zeroes,
the next write allocates the cluster again and the data is gone. A
discard that rides in an ALLOC writeback leaves the local BAT mapped
while disk has zero, so writes after it are lost on the next open.
fstrim or guest TRIM racing ordinary writes is enough.
Patch 4 is the fix: the completion applies the changes of the pios
attached to the writeback, and of the relocation done on grow, instead
of filtering the page by type. Patches 1 and 2 fix older bugs on the
same path that the old completion partly hid: a failed BAT writeback
freed the wrong clusters, and the online merge of the latest snapshot
left BAT levels above the top one. Patch 3 drops the dead PLOOP_DELAYWB
code.
Tested on dev-cl04, 6.12.0-211.52.1.22.9.vz10 with the module built
out of tree:
- a reproducer racing cluster discards with first writes on one BAT
page, 512 clusters a round: without the series 3 of 15360 first
writes read back as zeroes right after the write returned and stayed
lost after remount; with a 200 us sleep before bat_lock in the
allocation path 1801 of 2560; the reverse order, a sleep in the
discard path, left data written after a discard unmapped on disk.
With the series nothing is lost in either order;
- the ploop pytest suite, ploop and qcow2 formats, passes;
- nothing exercises a failing BAT writeback, that path is checked by
reading only.
Changes in v2, after Andrey's review:
- 2/4: also clear the deltas[] slot the top delta moved out of, as
notify_delta_merged() does. The md_lock in the renumbering stays: it
is per page, and notify_delta_merged() takes it the same way;
- 3/4: new, drops every PLOOP_DELAYWB block instead of only the one in
the completion;
- 4/4: the PLOOP_DELAYWB removal moved to 3/4, otherwise unchanged;
- Reviewed-by added to 1/4, 2/4 and 4/4.
The ploop pytest suite and the reproducer were rerun on v2.
v1: http://lore.virtuozzo.com/kernel/20261027163300.2166639-1-den@openvz.org/
Denis V. Lunev (4):
dm-ploop: fix freeing the wrong clusters when a BAT writeback fails
dm-ploop: renumber BAT levels when the latest snapshot is merged
dm-ploop: drop the dead PLOOP_DELAYWB code
dm-ploop: fix lost BAT updates when alloc and discard share a
writeback
drivers/md/dm-ploop-cmd.c | 25 +++++-
drivers/md/dm-ploop-map.c | 161 +++++++++++++++++---------------------
drivers/md/dm-ploop.h | 1 +
3 files changed, 95 insertions(+), 92 deletions(-)
base-commit: b499efa17aa9fb8f20512d1831d1cb61b22e60d3
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next reply other threads:[~2026-10-28 14:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 14:36 Denis V. Lunev [this message]
2026-10-28 14:36 ` [Devel] [PATCH hci-8.1 v2 1/4] dm-ploop: fix freeing the wrong clusters when a BAT writeback fails Denis V. Lunev
2026-10-28 15:00 ` no-reply
2026-10-28 14:36 ` [Devel] [PATCH hci-8.1 v2 2/4] dm-ploop: renumber BAT levels when the latest snapshot is merged Denis V. Lunev
2026-10-28 15:00 ` no-reply
2026-10-28 14:36 ` [Devel] [PATCH hci-8.1 v2 3/4] dm-ploop: drop the dead PLOOP_DELAYWB code Denis V. Lunev
2026-10-28 15:00 ` no-reply
2026-10-28 14:36 ` [Devel] [PATCH hci-8.1 v2 4/4] dm-ploop: fix lost BAT updates when alloc and discard share a writeback Denis V. Lunev
2026-10-28 15:06 ` no-reply
2026-10-28 15:16 ` [Devel] [PATCH hci-8.1 v2 0/4] dm-ploop: fix acknowledged writes lost when discard and allocation share a BAT writeback Andrey Zhadchenko
2026-11-02 10:42 ` Konstantin Khorenko
2026-11-02 10:44 ` Konstantin Khorenko
2026-11-02 15:32 ` 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=20261028143647.2972030-1-den@openvz.org \
--to=den@openvz.org \
--cc=andrey.zhadchenko@virtuozzo.com \
--cc=devel@openvz.org \
/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