summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2020-07-13 09:03:19 +0800
committerDavid Sterba <dsterba@suse.com>2020-07-27 12:55:44 +0200
commit5cb502f4ab6469c3d02bd787a3ff58a7b624ba67 (patch)
treec9601f3f6f724df51cd69f06d2af08aae0fbbd86 /fs/btrfs
parent813f8a0e268bbc9bee3667f68ab9a3d8ea9df3a1 (diff)
downloadlinux-5cb502f4ab6469c3d02bd787a3ff58a7b624ba67.tar.gz
linux-5cb502f4ab6469c3d02bd787a3ff58a7b624ba67.tar.bz2
linux-5cb502f4ab6469c3d02bd787a3ff58a7b624ba67.zip
btrfs: relocation: allow signal to cancel balance
Although btrfs balance can be canceled with "btrfs balance cancel" command, it's still almost muscle memory to press Ctrl-C to cancel a long running btrfs balance. So allow btrfs balance to check signal to determine if it should exit. The cancellation points are in known location and we're only adding one more reason, so this should be safe. Reviewed-by: Josef Bacik <josef@toxicpanda.com> 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')
-rw-r--r--fs/btrfs/relocation.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 523d2e5fab8f..2b869fb2e62c 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2656,7 +2656,8 @@ int setup_extent_mapping(struct inode *inode, u64 start, u64 end,
*/
int btrfs_should_cancel_balance(struct btrfs_fs_info *fs_info)
{
- return atomic_read(&fs_info->balance_cancel_req);
+ return atomic_read(&fs_info->balance_cancel_req) ||
+ fatal_signal_pending(current);
}
ALLOW_ERROR_INJECTION(btrfs_should_cancel_balance, TRUE);