diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2016-11-30 19:11:04 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-01-03 09:19:17 -0500 |
commit | e321f8a801d7b4c40da8005257b05b9c2b51b072 (patch) | |
tree | 11df9f784d72ca301b9bfca794fe70c9a0c43628 | |
parent | d0280996437081dd12ed1e982ac8aeaa62835ec4 (diff) |
Btrfs: use down_read_nested to make lockdep silent
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>
-rw-r--r-- | fs/btrfs/extent-tree.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index ac7e6713033c..dcd2e798767e 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -7387,7 +7387,8 @@ btrfs_lock_cluster(struct btrfs_block_group_cache *block_group, | |||
7387 | 7387 | ||
7388 | spin_unlock(&cluster->refill_lock); | 7388 | spin_unlock(&cluster->refill_lock); |
7389 | 7389 | ||
7390 | down_read(&used_bg->data_rwsem); | 7390 | /* We should only have one-level nested. */ |
7391 | down_read_nested(&used_bg->data_rwsem, SINGLE_DEPTH_NESTING); | ||
7391 | 7392 | ||
7392 | spin_lock(&cluster->refill_lock); | 7393 | spin_lock(&cluster->refill_lock); |
7393 | if (used_bg == cluster->block_group) | 7394 | if (used_bg == cluster->block_group) |