Skip to content

Commit

Permalink
btrfs: assert tree mod log lock in __tree_mod_log_insert
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Sterba committed Sep 9, 2019
1 parent d23ea3f commit 73e82fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,6 @@ void btrfs_put_tree_mod_seq(struct btrfs_fs_info *fs_info,
* The 'start address' is the logical address of the *new* root node
* for root replace operations, or the logical address of the affected
* block for all other operations.
*
* Note: must be called with write lock for fs_info::tree_mod_log_lock.
*/
static noinline int
__tree_mod_log_insert(struct btrfs_fs_info *fs_info, struct tree_mod_elem *tm)
Expand All @@ -387,6 +385,8 @@ __tree_mod_log_insert(struct btrfs_fs_info *fs_info, struct tree_mod_elem *tm)
struct rb_node *parent = NULL;
struct tree_mod_elem *cur;

lockdep_assert_held_write(&fs_info->tree_mod_log_lock);

tm->seq = btrfs_inc_tree_mod_seq(fs_info);

tm_root = &fs_info->tree_mod_log;
Expand Down

0 comments on commit 73e82fe

Please sign in to comment.