]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: reset block group chunk force if we have to wait
authorJosef Bacik <josef@toxicpanda.com>
Mon, 13 Jun 2022 22:31:17 +0000 (18:31 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2022 13:16:20 +0000 (15:16 +0200)
commit40d28ae57672188e4aa37de109d763d34e48e2eb
tree01314e7cdf2069eadef66e65e625b4397ae3f26c
parente2f1507303166c139d6b4362c5d88c50b84b4c4d
btrfs: reset block group chunk force if we have to wait

[ Upstream commit 1314ca78b2c35d3e7d0f097268a2ee6dc0d369ef ]

If you try to force a chunk allocation, but you race with another chunk
allocation, you will end up waiting on the chunk allocation that just
occurred and then allocate another chunk.  If you have many threads all
doing this at once you can way over-allocate chunks.

Fix this by resetting force to NO_FORCE, that way if we think we need to
allocate we can, otherwise we don't force another chunk allocation if
one is already happening.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
CC: stable@vger.kernel.org # 5.4+
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/block-group.c