diff options
author | Qu Wenruo <wqu@suse.com> | 2020-07-13 09:03:21 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-07-27 12:55:45 +0200 |
commit | 44d354abf33e92a5e73b965c84caf5a5d5e58a0b (patch) | |
tree | eb20cf1af6d250616b5aee54e7fdeb600b79d650 /fs/btrfs/ctree.h | |
parent | f3e3d9cc35252a70a2fd698762c9687718268ec6 (diff) | |
download | lwn-44d354abf33e92a5e73b965c84caf5a5d5e58a0b.tar.gz lwn-44d354abf33e92a5e73b965c84caf5a5d5e58a0b.zip |
btrfs: relocation: review the call sites which can be interrupted by signal
Since most metadata reservation calls can return -EINTR when get
interrupted by fatal signal, we need to review the all the metadata
reservation call sites.
In relocation code, the metadata reservation happens in the following
sites:
- btrfs_block_rsv_refill() in merge_reloc_root()
merge_reloc_root() is a pretty critical section, we don't want to be
interrupted by signal, so change the flush status to
BTRFS_RESERVE_FLUSH_LIMIT, so it won't get interrupted by signal.
Since such change can be ENPSPC-prone, also shrink the amount of
metadata to reserve least amount avoid deadly ENOSPC there.
- btrfs_block_rsv_refill() in reserve_metadata_space()
It calls with BTRFS_RESERVE_FLUSH_LIMIT, which won't get interrupted
by signal.
- btrfs_block_rsv_refill() in prepare_to_relocate()
- btrfs_block_rsv_add() in prepare_to_relocate()
- btrfs_block_rsv_refill() in relocate_block_group()
- btrfs_delalloc_reserve_metadata() in relocate_file_extent_cluster()
- btrfs_start_transaction() in relocate_block_group()
- btrfs_start_transaction() in create_reloc_inode()
Can be interrupted by fatal signal and we can handle it easily.
For these call sites, just catch the -EINTR value in btrfs_balance()
and count them as canceled.
CC: stable@vger.kernel.org # 5.4+
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
0 files changed, 0 insertions, 0 deletions