aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <[email protected]>2022-07-15 19:45:21 +0000
committerDavid Sterba <[email protected]>2022-09-26 10:27:54 +0000
commit2f12741f81af638dfb682dc2f24e6cbb67a37a2e (patch)
tree7d03a02d1e0a20e44f5c713b401406015cbe23d1
parentbtrfs: rename btrfs_insert_file_extent() to btrfs_insert_hole_extent() (diff)
downloadkernel-2f12741f81af638dfb682dc2f24e6cbb67a37a2e.tar.gz
kernel-2f12741f81af638dfb682dc2f24e6cbb67a37a2e.zip
btrfs: use btrfs_fs_closing for background bg work
For both unused bg deletion and async balance work we'll happily run if the fs is closing. However I want to move these to their own worker thread, and they can be long running jobs, so add a check to see if we're closing and simply bail. Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Josef Bacik <[email protected]> Signed-off-by: David Sterba <[email protected]>
-rw-r--r--fs/btrfs/block-group.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index e0375ba9d0fe..95d65c6bdf20 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -1304,6 +1304,9 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
if (!test_bit(BTRFS_FS_OPEN, &fs_info->flags))
return;
+ if (btrfs_fs_closing(fs_info))
+ return;
+
/*
* Long running balances can keep us blocked here for eternity, so
* simply skip deletion if we're unable to get the mutex.
@@ -1543,6 +1546,9 @@ void btrfs_reclaim_bgs_work(struct work_struct *work)
if (!test_bit(BTRFS_FS_OPEN, &fs_info->flags))
return;
+ if (btrfs_fs_closing(fs_info))
+ return;
+
if (!btrfs_should_reclaim(fs_info))
return;