summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorJustin Maggard <jmaggard10@gmail.com>2015-11-04 15:56:16 -0800
committerFilipe Manana <fdmanana@suse.com>2015-11-05 10:32:20 +0000
commit7343dd61fd1b57c40cc06a5b5b5386df7f73c3ac (patch)
treec272af51bf4bba2fd2e1429aa943ad8b78565ea7 /fs/btrfs/disk-io.c
parent9c9464cc92668984ebed79e22b5063877a8d97db (diff)
downloadlinux-stable-7343dd61fd1b57c40cc06a5b5b5386df7f73c3ac.tar.gz
linux-stable-7343dd61fd1b57c40cc06a5b5b5386df7f73c3ac.tar.bz2
linux-stable-7343dd61fd1b57c40cc06a5b5b5386df7f73c3ac.zip
btrfs: qgroup: exit the rescan worker during umount
I was hitting a consistent NULL pointer dereference during shutdown that showed the trace running through end_workqueue_bio(). I traced it back to the endio_meta_workers workqueue being poked after it had already been destroyed. Eventually I found that the root cause was a qgroup rescan that was still in progress while we were stopping all the btrfs workers. Currently we explicitly pause balance and scrub operations in close_ctree(), but we do nothing to stop the qgroup rescan. We should probably be doing the same for qgroup rescan, but that's a much larger change. This small change is good enough to allow me to unmount without crashing. Signed-off-by: Justin Maggard <jmaggard@netgear.com> Reviewed-by: Filipe Manana <fdmanana@suse.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 2d4667594681..1eb08393bff0 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3780,6 +3780,9 @@ void close_ctree(struct btrfs_root *root)
fs_info->closing = 1;
smp_mb();
+ /* wait for the qgroup rescan worker to stop */
+ btrfs_qgroup_wait_for_completion(fs_info);
+
/* wait for the uuid_scan task to finish */
down(&fs_info->uuid_tree_rescan_sem);
/* avoid complains from lockdep et al., set sem back to initial state */