]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
btrfs: assert delayed refs lock is held at find_first_ref_head()
authorFilipe Manana <fdmanana@suse.com>
Wed, 23 Oct 2024 11:43:35 +0000 (12:43 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 11 Nov 2024 13:34:20 +0000 (14:34 +0100)
The delayed refs lock must be held when calling find_first_ref_head(), so
assert that it's being held.

Reviewed-by: Boris Burkov <boris@bur.io>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/delayed-ref.c

index 9f8853fb9fa6626766375250a5e95e698a9d389c..f74154c56432045a024f1186ac00e19d1001220f 100644 (file)
@@ -384,6 +384,8 @@ static struct btrfs_delayed_ref_head *find_first_ref_head(
        struct rb_node *n;
        struct btrfs_delayed_ref_head *entry;
 
+       lockdep_assert_held(&dr->lock);
+
        n = rb_first_cached(&dr->href_root);
        if (!n)
                return NULL;