[Devel] [PATCH hci-8.1 0/3] dm-ploop: fix acknowledged writes lost when discard and allocation share a BAT writeback
Andrey Zhadchenko
andrey.zhadchenko at virtuozzo.com
Wed Oct 28 17:02:53 MSK 2026
I have left a few suggestions, but the patches can be merges as-is anyway.
Therefore,
Reviewed-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
On 10/27/26 17:32, Denis V. Lunev wrote:
> 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 3 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.
>
> 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.
>
> Denis V. Lunev (3):
> 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: fix lost BAT updates when alloc and discard share a
> writeback
>
> drivers/md/dm-ploop-cmd.c | 22 ++++++
> drivers/md/dm-ploop-map.c | 139 +++++++++++++++++++-------------------
> drivers/md/dm-ploop.h | 1 +
> 3 files changed, 93 insertions(+), 69 deletions(-)
>
>
> base-commit: 02401c5e378f282fbf11bdc65996253ff65dad9b
More information about the Devel
mailing list