diff options
author | Filipe Manana <fdmanana@suse.com> | 2023-05-04 13:04:24 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-06-19 13:59:24 +0200 |
commit | 91de9e978d1c32c477e14f44a7e945f17863c66e (patch) | |
tree | 08a853263cbbd6858c39b297e1236e78033243c7 /fs/btrfs/free-space-cache.c | |
parent | btrfs: assert proper locks are held at tree_insert_offset() (diff) | |
download | linux-91de9e978d1c32c477e14f44a7e945f17863c66e.tar.xz linux-91de9e978d1c32c477e14f44a7e945f17863c66e.zip |
btrfs: assert tree lock is held when searching for free space entries
When searching for a free space entry by offset, at tree_search_offset(),
we are supposed to have the btrfs_free_space_ctl's 'tree_lock' held, so
assert that. We have multiple callers of tree_search_offset(), and all
currently hold the necessary lock before calling it.
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/free-space-cache.c')
-rw-r--r-- | fs/btrfs/free-space-cache.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index be45be6ec888..f3361ebfef4a 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -1721,6 +1721,8 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl, struct rb_node *n = ctl->free_space_offset.rb_node; struct btrfs_free_space *entry = NULL, *prev = NULL; + lockdep_assert_held(&ctl->tree_lock); + /* find entry that is closest to the 'offset' */ while (n) { entry = rb_entry(n, struct btrfs_free_space, offset_index); |