]> git.baikalelectronics.ru Git - kernel.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>
Wed, 17 Aug 2022 12:24:24 +0000 (14:24 +0200)
commit99f7e0799327ab85f96f277d03dbfeab03810f3c
tree4e38a7d723e2fd3ef579158f72f7c6416205b83e
parent64e9441412004e2fe2951b6e6b54cb3e806c39ae
btrfs: reset block group chunk force if we have to wait

[ Upstream commit b458761ba924e524f93716713eae84498044e340 ]

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