diff options
author | Justin Maggard <jmaggard10@gmail.com> | 2015-11-06 19:36:42 +0100 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-11-25 14:22:08 +0100 |
commit | 967ef5131e42d6e3bb216c44161d893048a49957 (patch) | |
tree | 245253c420e34541f82ef76d46f2b89226ab025b /fs/btrfs/qgroup.c | |
parent | Btrfs: fix race between cleaner kthread and space cache writeout (diff) | |
download | linux-967ef5131e42d6e3bb216c44161d893048a49957.tar.xz linux-967ef5131e42d6e3bb216c44161d893048a49957.zip |
btrfs: qgroup: fix quota disable during rescan
There's a race condition that leads to a NULL pointer dereference if you
disable quotas while a quota rescan is running. To fix this, we just need
to wait for the quota rescan worker to actually exit before tearing down
the quota structures.
Signed-off-by: Justin Maggard <jmaggard@netgear.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to '')
-rw-r--r-- | fs/btrfs/qgroup.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 93e12c18ffd7..fd0a196c8f74 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -993,9 +993,10 @@ int btrfs_quota_disable(struct btrfs_trans_handle *trans, mutex_lock(&fs_info->qgroup_ioctl_lock); if (!fs_info->quota_root) goto out; - spin_lock(&fs_info->qgroup_lock); fs_info->quota_enabled = 0; fs_info->pending_quota_state = 0; + btrfs_qgroup_wait_for_completion(fs_info); + spin_lock(&fs_info->qgroup_lock); quota_root = fs_info->quota_root; fs_info->quota_root = NULL; fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_ON; |