Btrfs: fix qgroup rescan worker initialization
authorFilipe Manana <fdmanana@suse.com>
Thu, 24 Nov 2016 02:09:04 +0000 (02:09 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Jan 2017 10:16:06 +0000 (11:16 +0100)
commit1f5adadcd03266a461ebe752964c40a3dc95bf2f
treeeb65932323fb8ab1f5f6466612c1a50bc82ff439
parentb5e715ed11ec7b759fe72c1ecc05a9b0850045ec
Btrfs: fix qgroup rescan worker initialization

commit 8d9eddad19467b008e0c881bc3133d7da94b7ec1 upstream.

We were setting the qgroup_rescan_running flag to true only after the
rescan worker started (which is a task run by a queue). So if a user
space task starts a rescan and immediately after asks to wait for the
rescan worker to finish, this second call might happen before the rescan
worker task starts running, in which case the rescan wait ioctl returns
immediatley, not waiting for the rescan worker to finish.

This was making the fstest btrfs/022 fail very often.

Fixes: d2c609b834d6 (btrfs: properly track when rescan worker is running)
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/qgroup.c