btrfs: assert extent map tree lock in add_extent_mapping

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>
This commit is contained in:
David Sterba 2019-03-27 16:19:55 +01:00
parent 982f1f5d16
commit d23ea3fa7d

View File

@ -384,6 +384,8 @@ int add_extent_mapping(struct extent_map_tree *tree,
{ {
int ret = 0; int ret = 0;
lockdep_assert_held_write(&tree->lock);
ret = tree_insert(&tree->map, em); ret = tree_insert(&tree->map, em);
if (ret) if (ret)
goto out; goto out;