[2/5] btrfs: assert extent map tree lock in add_extent_mapping
diff mbox series

Message ID 5fb9699164475ff7ba825fb31b7b0d1b84d2f359.1559321947.git.dsterba@suse.com
State New
Headers show
Series
  • More lockdep annotations
Related show

Commit Message

David Sterba May 31, 2019, 5:01 p.m. UTC
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.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/extent_map.c | 2 ++
 1 file changed, 2 insertions(+)

Patch
diff mbox series

diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 9558d79faf1e..a73af4159495 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -384,6 +384,8 @@  int add_extent_mapping(struct extent_map_tree *tree,
 {
 	int ret = 0;
 
+	lockdep_assert_held_exclusive(&tree->lock);
+
 	ret = tree_insert(&tree->map, em);
 	if (ret)
 		goto out;