diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2013-05-14 06:20:41 -0400 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-06-14 11:29:33 -0400 |
commit | 05323cd13503937e71d5c6ef2debf69e51a9634f (patch) | |
tree | d45690a9f9abf12a04616213ac9161dd8305d69a /fs/btrfs/disk-io.c | |
parent | d027824564c5fcee19109530b87c94c9908e910a (diff) |
Btrfs: make the cleaner complete early when the fs is going to be umounted
Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 7a54b8e7d124..06f2c011db03 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1674,12 +1674,14 @@ static void end_workqueue_fn(struct btrfs_work *work) | |||
1674 | } | 1674 | } |
1675 | 1675 | ||
1676 | /* | 1676 | /* |
1677 | * If we remount the fs to be R/O, the cleaner needn't do anything except | 1677 | * If we remount the fs to be R/O or umount the fs, the cleaner needn't do |
1678 | * sleeping. This function is used to check the status of the fs. | 1678 | * anything except sleeping. This function is used to check the status of |
1679 | * the fs. | ||
1679 | */ | 1680 | */ |
1680 | static inline int need_cleaner_sleep(struct btrfs_root *root) | 1681 | static inline int need_cleaner_sleep(struct btrfs_root *root) |
1681 | { | 1682 | { |
1682 | return root->fs_info->sb->s_flags & MS_RDONLY; | 1683 | return (root->fs_info->sb->s_flags & MS_RDONLY || |
1684 | btrfs_fs_closing(root->fs_info)); | ||
1683 | } | 1685 | } |
1684 | 1686 | ||
1685 | static int cleaner_kthread(void *arg) | 1687 | static int cleaner_kthread(void *arg) |
@@ -1702,8 +1704,8 @@ static int cleaner_kthread(void *arg) | |||
1702 | mutex_unlock(&root->fs_info->cleaner_mutex); | 1704 | mutex_unlock(&root->fs_info->cleaner_mutex); |
1703 | 1705 | ||
1704 | /* | 1706 | /* |
1705 | * The defragger has dealt with the R/O remount, needn't | 1707 | * The defragger has dealt with the R/O remount and umount, |
1706 | * do anything special here. | 1708 | * needn't do anything special here. |
1707 | */ | 1709 | */ |
1708 | btrfs_run_defrag_inodes(root->fs_info); | 1710 | btrfs_run_defrag_inodes(root->fs_info); |
1709 | sleep: | 1711 | sleep: |