]> www.infradead.org Git - users/jedix/linux-maple.git/commit
btrfs: add assertions and comment about path expectations to btrfs_cross_ref_exist()
authorFilipe Manana <fdmanana@suse.com>
Tue, 10 Dec 2024 11:51:11 +0000 (11:51 +0000)
committerDavid Sterba <dsterba@suse.com>
Mon, 13 Jan 2025 13:53:16 +0000 (14:53 +0100)
commit88694f74f4853b01dae678fb8d5f2c46948ae620
tree86dc4679bfd78d5242cf6182a5874b7e3782a0cb
parent2747c555958448eb32fc953b28798c1b55df4e1d
btrfs: add assertions and comment about path expectations to btrfs_cross_ref_exist()

We should always call check_delayed_ref() with a path having a locked leaf
from the extent tree where either the extent item is located or where it
should be located in case it doesn't exist yet (when there's a pending
unflushed delayed ref to do it), as we need to lock any existing delayed
ref head while holding such leaf locked in order to avoid races with
flushing delayed references, which could make us think an extent is not
shared when it really is.

So add some assertions and a comment about such expectations to
btrfs_cross_ref_exist(), which is the only caller of check_delayed_ref().

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c
fs/btrfs/locking.h