]> git.baikalelectronics.ru Git - kernel.git/commitdiff
btrfs: assert tree is locked when clearing extent map from logging
authorFilipe Manana <fdmanana@suse.com>
Mon, 19 Sep 2022 14:06:36 +0000 (15:06 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 29 Sep 2022 15:08:31 +0000 (17:08 +0200)
When calling clear_em_logging() we should have a write lock on the extent
map tree, as we will try to merge the extent map with the previous and
next ones in the tree. So assert that we have a write lock.

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/extent_map.c

index 6b7eee92d9810fb9f13649648c7cbb777c31907a..f1616aa8d0f5ad6788be87d4975d6e1a1842e30e 100644 (file)
@@ -334,6 +334,8 @@ out:
 
 void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em)
 {
+       lockdep_assert_held_write(&tree->lock);
+
        clear_bit(EXTENT_FLAG_LOGGING, &em->flags);
        if (extent_map_in_tree(em))
                try_merge_map(tree, em);