]> 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)
commit76e892778956f4b77342d1b77292c0281321aba5
tree70b3a60c496d009afbaf29d7da0d73ea9b6b02b5
parent9779fff46b31298662f1dbbcc4f2a727a5f63a88
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