]> git.hungrycats.org Git - linux/commit
btrfs: backref: treat transient backref walk failures as shared extents
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sat, 18 Jul 2026 03:20:23 +0000 (23:20 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 18 Sep 2026 21:36:33 +0000 (17:36 -0400)
commit23032968b3815d92bb3ee4a1024ee6f367938492
treef8dbf9ac6193ca42cb47236b3b0413eb4de69af0
parent93a5c4b850c1a8fab49a535aea967154d7b236b0
btrfs: backref: treat transient backref walk failures as shared extents

btrfs_is_data_extent_shared() can now receive -EAGAIN from a backref
walk when the tree mod log rewound view of a subvolume tree became
inconsistent with the current contents of its leaves (see
add_all_parents()). Its callers - fiemap and swap file activation -
cannot retry with a fresh tree mod log sequence number from that deep
in the call chain, and their user space interfaces do not expect
transient errors.

Conservatively report the extent as shared instead, without storing the
answer in the sharedness caches. The condition only arises while the
extent's trees are being concurrently modified, and in that situation
any sharedness answer may be stale by the time the caller sees it:
fiemap's SHARED flag is best effort by design, and refusing swap file
activation (which maps sharedness to "swapfile must not be
copy-on-write") for a file that is being concurrently cloned is the
safe answer.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
fs/btrfs/backref.c