]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: reset RO counter on block group if we fail to relocate
authorJosef Bacik <josef@toxicpanda.com>
Mon, 25 Jul 2022 17:05:05 +0000 (13:05 -0400)
committerDavid Sterba <dsterba@suse.com>
Wed, 27 Jul 2022 19:23:16 +0000 (21:23 +0200)
commit73c180b0199de2d85e3d43c15eee21b7e8f2b43e
tree48290c167d6390e4f4ba07bcee76e2933315e72a
parentec6b332ee9974b11a9ebe65ce93289f4daff1f2b
btrfs: reset RO counter on block group if we fail to relocate

With the automatic block group reclaim code we will preemptively try to
mark the block group RO before we start the relocation.  We do this to
make sure we should actually try to relocate the block group.

However if we hit an error during the actual relocation we won't clean
up our RO counter and the block group will remain RO.  This was observed
internally with file systems reporting less space available from df when
we had failed background relocations.

Fix this by doing the dec_ro in the error case.

Fixes: 9d8d2570b3af ("btrfs: zoned: automatically reclaim zones")
CC: stable@vger.kernel.org # 5.15+
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.c