]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: release path before calling to btrfs_load_block_group_zone_info
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Thu, 4 Feb 2021 10:21:44 +0000 (19:21 +0900)
committerDavid Sterba <dsterba@suse.com>
Tue, 9 Feb 2021 01:32:20 +0000 (02:32 +0100)
commitba6442759c93fb17079e482f5895dd0639b13fa6
tree70b3a60c496d009afbaf29d7da0d73ea9b6b02b5
parent1d945e7d0af7fb87eda37b72202b3a7d54124650
btrfs: release path before calling to btrfs_load_block_group_zone_info

Since we have no write pointer in conventional zones, we cannot
determine the allocation offset from it. Instead, we set the allocation
offset after the highest addressed extent. This is done by reading the
extent tree in btrfs_load_block_group_zone_info().

However, this function is called from btrfs_read_block_groups(), so the
read lock for the tree node could be recursively taken.

To avoid this unsafe locking scenario, release the path before reading
the extent tree to get the allocation offset.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.c