]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: zoned: zone finish unused block group
authorNaohiro Aota <naohiro.aota@wdc.com>
Wed, 4 May 2022 00:48:54 +0000 (17:48 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 16 May 2022 15:17:32 +0000 (17:17 +0200)
commit959236c543574ccb17b061c170a32876098acdb9
tree5cb3fb1c215e45941ec774285385809a73b1260d
parent90fb88cfd5bccb3b9af96a2ac676867ecefd6ea2
btrfs: zoned: zone finish unused block group

While the active zones within an active block group are reset, and their
active resource is released, the block group itself is kept in the active
block group list and marked as active. As a result, the list will contain
more than max_active_zones block groups. That itself is not fatal for the
device as the zones are properly reset.

However, that inflated list is, of course, strange. Also, a to-appear
patch series, which deactivates an active block group on demand, gets
confused with the wrong list.

So, fix the issue by finishing the unused block group once it gets
read-only, so that we can release the active resource in an early stage.

Fixes: 87590247c4c5 ("btrfs: zoned: finish fully written block group")
CC: stable@vger.kernel.org # 5.16+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.c