Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 967ef513 authored by Justin Maggard's avatar Justin Maggard Committed by Chris Mason
Browse files

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: default avatarJustin Maggard <jmaggard@netgear.com>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent 036a9348
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;