aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>2014-04-09 07:23:22 -0400
committerChris Mason <clm@fb.com>2014-06-09 20:20:43 -0400
commitde348ee022175401e77d7662b7ca6e231a94e3fd (patch)
tree2fd516cb693fbdced5c840a38bc85baecd740e41
parent59885b39303edc0b3284f324a1ca42cb6e7742d0 (diff)
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 <wangsl.fnst@cn.fujitsu.com> Reviewed-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r--fs/btrfs/disk-io.c5
1 files changed, 5 insertions, 0 deletions
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)
3657 3657
3658 btrfs_free_block_groups(fs_info); 3658 btrfs_free_block_groups(fs_info);
3659 3659
3660 /*
3661 * we must make sure there is not any read request to
3662 * submit after we stopping all workers.
3663 */
3664 invalidate_inode_pages2(fs_info->btree_inode->i_mapping);
3660 btrfs_stop_all_workers(fs_info); 3665 btrfs_stop_all_workers(fs_info);
3661 3666
3662 free_root_pointers(fs_info, 1); 3667 free_root_pointers(fs_info, 1);