]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: assert we have a write lock when removing and replacing extent maps
authorFilipe Manana <fdmanana@suse.com>
Thu, 3 Feb 2022 15:36:45 +0000 (15:36 +0000)
committerDavid Sterba <dsterba@suse.com>
Mon, 14 Mar 2022 12:13:50 +0000 (13:13 +0100)
commit5a4da65ef2e7d5fe57d1a03cb59867befa6179c4
treeecceb0732de1c11c49ff354a9b6b328ec285d219
parentde8fffa0c93fd6454a9841de6dad26d28c56e3ed
btrfs: assert we have a write lock when removing and replacing extent maps

Removing or replacing an extent map requires holding a write lock on the
extent map's tree. We currently do that everywhere, except in one of the
self tests, where it's harmless since there's no concurrency.

In order to catch possible races in the future, assert that we are holding
a write lock on the extent map tree before removing or replacing an extent
map in the tree, and update the self test to obtain a write lock before
removing extent maps.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_map.c
fs/btrfs/tests/extent-map-tests.c