Skip to content

btrfs: fix a corruption after snapshoting a new subvolume

[email protected] linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3btrfs: fix unwritten extent buffer after snapshoting a new subvolumefs/btrfs/backref.c fs/btrfs/backref.h fs/btrfs/ctree.c +2 more+33 -150 replies
2/3btrfs: use bool for return type of btrfs_block_can_be_shared()fs/btrfs/ctree.c fs/btrfs/ctree.h+9 -91 reply
3/3btrfs: make the logic from btrfs_block_can_be_shared() easier to readfs/btrfs/ctree.c+24 -160 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchAnand JainJosef Bacik
SeriesR-b
1/3
2/3R-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] btrfs: fix a corruption after snapshoting a new subvolume

From: Filipe Manana <[email protected]>

Starting with kernel 6.5, we no longer commit the transaction used to create a subvolume when we finish creating the subvolume. This behaviour was introduced for performance reasons and done with commit 1b53e51a4a8f ("btrfs: don't commit transaction for every subvol create"). However this allows for a corruption if we snapshot a subvolume created in the current transaction, where basically we get a snapshot root that points to an extent buffer that was not written. This makes attempt to read the extent buffer later to fail, either with the infamous "parent transid verify failed ..." error or with checksum failures.

More details on the changelog of the first patch, and the remaining patches are just cleanups.

Filipe Manana (3):
btrfs: fix unwritten extent buffer after snapshoting a new subvolume
btrfs: use bool for return type of btrfs_block_can_be_shared()
btrfs: make the logic from btrfs_block_can_be_shared() easier to read

 fs/btrfs/backref.c    | 14 +++++++++-----
 fs/btrfs/backref.h    |  3 ++-
 fs/btrfs/ctree.c      | 39 +++++++++++++++++++++++++++++----------
 fs/btrfs/ctree.h      |  5 +++--
 fs/btrfs/relocation.c |  7 ++++---
 5 files changed, 47 insertions(+), 21 deletions(-)
Signature · 1 line
2.40.1