From: Wang Shilong Date: Wed, 9 Apr 2014 11:23:22 +0000 (+0800) Subject: Btrfs: make sure there are not any read requests before stopping workers X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=de348ee022175401e77d7662b7ca6e231a94e3fd;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git Btrfs: make sure there are not any read requests before stopping workers In close_ctree(), after we have stopped all workers,there maybe still some read requests(for example readahead) to submit and this *maybe* trigger an oops that user reported before: kernel BUG at fs/btrfs/async-thread.c:619! By hacking codes, i can reproduce this problem with one cpu available. We fix this potential problem by invalidating all btree inode pages before stopping all workers. Thanks to Miao for pointing out this problem. Signed-off-by: Wang Shilong Reviewed-by: David Sterba Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index d3bd34e434f6..f4e708239c09 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3657,6 +3657,11 @@ int close_ctree(struct btrfs_root *root) btrfs_free_block_groups(fs_info); + /* + * we must make sure there is not any read request to + * submit after we stopping all workers. + */ + invalidate_inode_pages2(fs_info->btree_inode->i_mapping); btrfs_stop_all_workers(fs_info); free_root_pointers(fs_info, 1);