summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2013-05-14 10:20:41 +0000
committerJosef Bacik <jbacik@fusionio.com>2013-06-14 11:29:33 -0400
commit05323cd13503937e71d5c6ef2debf69e51a9634f (patch)
treed45690a9f9abf12a04616213ac9161dd8305d69a /fs/btrfs/disk-io.c
parentd027824564c5fcee19109530b87c94c9908e910a (diff)
downloadtalos-op-linux-05323cd13503937e71d5c6ef2debf69e51a9634f.tar.gz
talos-op-linux-05323cd13503937e71d5c6ef2debf69e51a9634f.zip
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.c12
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)
}
/*
- * If we remount the fs to be R/O, the cleaner needn't do anything except
- * sleeping. This function is used to check the status of the fs.
+ * If we remount the fs to be R/O or umount the fs, the cleaner needn't do
+ * anything except sleeping. This function is used to check the status of
+ * the fs.
*/
static inline int need_cleaner_sleep(struct btrfs_root *root)
{
- return root->fs_info->sb->s_flags & MS_RDONLY;
+ return (root->fs_info->sb->s_flags & MS_RDONLY ||
+ btrfs_fs_closing(root->fs_info));
}
static int cleaner_kthread(void *arg)
@@ -1702,8 +1704,8 @@ static int cleaner_kthread(void *arg)
mutex_unlock(&root->fs_info->cleaner_mutex);
/*
- * The defragger has dealt with the R/O remount, needn't
- * do anything special here.
+ * The defragger has dealt with the R/O remount and umount,
+ * needn't do anything special here.
*/
btrfs_run_defrag_inodes(root->fs_info);
sleep:
OpenPOWER on IntegriCloud