]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: use global reserve when deleting unused block group after ENOSPC
authorFilipe Manana <fdmanana@suse.com>
Fri, 13 Nov 2015 23:57:16 +0000 (23:57 +0000)
committerChris Mason <clm@fb.com>
Wed, 25 Nov 2015 13:19:50 +0000 (05:19 -0800)
commit889f4a010398cf87b51fbcf3046d22b4d2a2669a
tree5643956c3953881b148c58616591c3e4948ea687
parent27e9bb010fc44c8dac8fbf591dbf8de7d864abfe
Btrfs: use global reserve when deleting unused block group after ENOSPC

It's possible to reach a state where the cleaner kthread isn't able to
start a transaction to delete an unused block group due to lack of enough
free metadata space and due to lack of unallocated device space to allocate
a new metadata block group as well. If this happens try to use space from
the global block group reserve just like we do for unlink operations, so
that we don't reach a permanent state where starting a transaction for
filesystem operations (file creation, renames, etc) keeps failing with
-ENOSPC. Such an unfortunate state was observed on a machine where over
a dozen unused data block groups existed and the cleaner kthread was
failing to delete them due to ENOSPC error when attempting to start a
transaction, and even running balance with a -dusage=0 filter failed with
ENOSPC as well. Also unmounting and mounting again the filesystem didn't
help. Allowing the cleaner kthread to use the global block reserve to
delete the unused data block groups fixed the problem.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/ctree.h
fs/btrfs/extent-tree.c
fs/btrfs/inode.c
fs/btrfs/transaction.c
fs/btrfs/transaction.h
fs/btrfs/volumes.c