diff options
author | Josef Bacik <jbacik@fusionio.com> | 2013-05-30 16:55:44 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-06-08 15:11:35 -0400 |
commit | 13e6c37b989859e70b0d73d3f2cb0aa022159b17 (patch) | |
tree | 20fa0ee3fd51a6b0ea3d1099eed52e8f609eb76f /fs | |
parent | 2932505abe7c56477315a3d93ffb3c27c5182e9d (diff) |
Btrfs: stop all workers before cleaning up roots
Dave reported a panic because the extent_root->commit_root was NULL in the
caching kthread. That is because we just unset it in free_root_pointers, which
is not the correct thing to do, we have to either wait for the caching kthread
to complete or hold the extent_commit_sem lock so we know the thread has exited.
This patch makes the kthreads all stop first and then we do our cleanup. This
should fix the race. Thanks,
Reported-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/disk-io.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 7c66c2314c14..b8b60b660c8f 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -3514,13 +3514,13 @@ int close_ctree(struct btrfs_root *root) | |||
3514 | 3514 | ||
3515 | btrfs_free_block_groups(fs_info); | 3515 | btrfs_free_block_groups(fs_info); |
3516 | 3516 | ||
3517 | free_root_pointers(fs_info, 1); | 3517 | btrfs_stop_all_workers(fs_info); |
3518 | 3518 | ||
3519 | del_fs_roots(fs_info); | 3519 | del_fs_roots(fs_info); |
3520 | 3520 | ||
3521 | iput(fs_info->btree_inode); | 3521 | free_root_pointers(fs_info, 1); |
3522 | 3522 | ||
3523 | btrfs_stop_all_workers(fs_info); | 3523 | iput(fs_info->btree_inode); |
3524 | 3524 | ||
3525 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY | 3525 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY |
3526 | if (btrfs_test_opt(root, CHECK_INTEGRITY)) | 3526 | if (btrfs_test_opt(root, CHECK_INTEGRITY)) |