If we freeze the fs, the auto defragment should not run. Fix it.

Signed-off-by: Miao Xie <[email protected]>
---
 fs/btrfs/file.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 6ca2b46..40b17d0 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -318,8 +318,11 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info 
*fs_info,
        memset(&range, 0, sizeof(range));
        range.len = (u64)-1;
        range.start = defrag->last_offset;
+
+       sb_start_write(fs_info->sb);
        num_defrag = btrfs_defrag_file(inode, NULL, &range, defrag->transid,
                                       BTRFS_DEFRAG_BATCH);
+       sb_end_write(fs_info->sb);
        /*
         * if we filled the whole defrag batch, there
         * must be more work to do.  Queue this defrag
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to