Skip to content

Commit

Permalink
Btrfs: stop all workers before cleaning up roots
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
  • Loading branch information
Josef Bacik authored and Chris Mason committed Jun 8, 2013
1 parent 2932505 commit 13e6c37
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 13e6c37

Please sign in to comment.