btrfs: assert extent map tree lock in add_extent_mapping
authorDavid Sterba <dsterba@suse.com>
Wed, 27 Mar 2019 15:19:55 +0000 (16:19 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 9 Sep 2019 12:59:00 +0000 (14:59 +0200)
As add_extent_mapping is called from several functions, let's add the
lock annotation. The tree is going to be modified so it must be the
exclusive lock.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_map.c

index 9558d79faf1e4c3d1d9931e5f600f3732463fed3..9d30acca55e170498a25a8325c65c82ed33d26a9 100644 (file)
@@ -384,6 +384,8 @@ int add_extent_mapping(struct extent_map_tree *tree,
 {
        int ret = 0;
 
+       lockdep_assert_held_write(&tree->lock);
+
        ret = tree_insert(&tree->map, em);
        if (ret)
                goto out;