]> git.hungrycats.org Git - linux/commit
btrfs: force a transaction commit when fsyncing stripe-tree extents
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Thu, 22 Oct 2026 09:06:53 +0000 (11:06 +0200)
committerDavid Sterba <dsterba@suse.com>
Fri, 30 Oct 2026 20:36:18 +0000 (21:36 +0100)
commitb9569eda415cb36432ec303e2336be1261d03933
tree1e834412cab0d9c1e594bb46828935140b77d4c6
parent5dd650d8e5009d0512c96fee2a291978eec4181f
btrfs: force a transaction commit when fsyncing stripe-tree extents

An extent in a block-group that uses the RAID stripe-tree has its logical
to physical mapping stored in that tree, which only becomes persistent
when the stripe-tree is written out at transaction commit. But the RAID
stripe-tree is not logged in the log tree.

A fsync therefore logs a file-extent item whose logical range cannot be
resolved after a crash. Replay restores the file-extent item and the
file has the correct size, but reading it fails with EIO and nothing is
reported.

Force a full commit when logging such an extent. Extents reach the log
both from log_one_extent() and from copy_items(), so check in both.
copy_items() skips extents from a past transaction, their mapping is
already committed, the same reason their checksums are not logged.

Fixes: 02c372e1f016 ("btrfs: add support for inserting raid stripe extents")
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-log.c