]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: zoned: fix unpaired block group unfreeze during device replace
authorFilipe Manana <fdmanana@suse.com>
Wed, 14 Apr 2021 13:05:26 +0000 (14:05 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 20 Apr 2021 17:32:43 +0000 (19:32 +0200)
commitc7106b35013b97a104152b0fcb6adfddd3717391
treebd557553ae941f9d9fabd0c8c12bfd3231607cf9
parentbbf3a993d6058285b60b9e5cc397faca883c7748
btrfs: zoned: fix unpaired block group unfreeze during device replace

When doing a device replace on a zoned filesystem, if we find a block
group with ->to_copy == 0, we jump to the label 'done', which will result
in later calling btrfs_unfreeze_block_group(), even though at this point
we never called btrfs_freeze_block_group().

Since at this point we have neither turned the block group to RO mode nor
made any progress, we don't need to jump to the label 'done'. So fix this
by jumping instead to the label 'skip' and dropping our reference on the
block group before the jump.

Fixes: 53d308493c29e4 ("btrfs: zoned: mark block groups to copy for device-replace")
CC: stable@vger.kernel.org # 5.12
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/scrub.c