Skip to content

Commit

Permalink
Btrfs: use down_read_nested to make lockdep silent
Browse files Browse the repository at this point in the history
If @block_group is not @used_bg, it'll try to get @used_bg's lock without
droping @block_group 's lock and lockdep has throwed a scary deadlock warning
about it.
Fix it by using down_read_nested.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Liu Bo authored and kdave committed Jan 3, 2017
1 parent d028099 commit e321f8a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -7387,7 +7387,8 @@ btrfs_lock_cluster(struct btrfs_block_group_cache *block_group,

spin_unlock(&cluster->refill_lock);

down_read(&used_bg->data_rwsem);
/* We should only have one-level nested. */
down_read_nested(&used_bg->data_rwsem, SINGLE_DEPTH_NESTING);

spin_lock(&cluster->refill_lock);
if (used_bg == cluster->block_group)
Expand Down

0 comments on commit e321f8a

Please sign in to comment.