Commit 13e6c37b authored by Josef Bacik's avatar Josef Bacik Committed by Chris Mason

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: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent 2932505a
......@@ -3514,13 +3514,13 @@ int close_ctree(struct btrfs_root *root)
btrfs_free_block_groups(fs_info);
free_root_pointers(fs_info, 1);
btrfs_stop_all_workers(fs_info);
del_fs_roots(fs_info);
iput(fs_info->btree_inode);
free_root_pointers(fs_info, 1);
btrfs_stop_all_workers(fs_info);
iput(fs_info->btree_inode);
#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
if (btrfs_test_opt(root, CHECK_INTEGRITY))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment