From dc81cdc58ad2f413b96b9004f8d681e5dc554473 Mon Sep 17 00:00:00 2001 From: Miao Xie Date: Wed, 20 Feb 2013 23:32:52 -0700 Subject: Btrfs: fix remount vs autodefrag If we remount the fs to close the auto defragment or make the fs R/O, we should stop the auto defragment. Signed-off-by: Miao Xie Signed-off-by: Chris Mason --- fs/btrfs/file.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'fs/btrfs/file.c') diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 9f67e623206d..6e6dd8cdad92 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -374,6 +374,11 @@ int btrfs_run_defrag_inodes(struct btrfs_fs_info *fs_info) atomic_inc(&fs_info->defrag_running); while(1) { + /* Pause the auto defragger. */ + if (test_bit(BTRFS_FS_STATE_REMOUNTING, + &fs_info->fs_state)) + break; + if (!__need_auto_defrag(fs_info->tree_root)) break; -- cgit v1.2.3