btrfs: bail out reclaim process if filesystem is read-only
authorNaohiro Aota <naota@elisp.net>
Tue, 6 Jun 2023 05:36:35 +0000 (14:36 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Jul 2023 14:22:13 +0000 (16:22 +0200)
commit3702c5342cf17c4cda6d53dec6c8261e289a85bc
tree1fdae59a5b790e0247a87906741b57d0bd08efea
parent85608610951515be02dc5a22ded5b0f19e0c06b3
btrfs: bail out reclaim process if filesystem is read-only

commit 93463ff7b54626f8276c0bd3d3f968fbf8d5d380 upstream.

When a filesystem is read-only, we cannot reclaim a block group as it
cannot rewrite the data. Just bail out in that case.

Note that it can drop block groups in this case. As we did
sb_start_write(), read-only filesystem means we got a fatal error and
forced read-only. There is no chance to reclaim them again.

Fixes: 18bb8bbf13c1 ("btrfs: zoned: automatically reclaim zones")
CC: stable@vger.kernel.org # 5.15+
Reviewed-by: Filipe Manana <fdmanana@suse.com>
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/block-group.c