]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Aug 2022 11:16:48 +0000 (13:16 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Aug 2022 11:16:48 +0000 (13:16 +0200)
added patches:
btrfs-reset-block-group-chunk-force-if-we-have-to-wait.patch

queue-5.4/btrfs-reset-block-group-chunk-force-if-we-have-to-wait.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/btrfs-reset-block-group-chunk-force-if-we-have-to-wait.patch b/queue-5.4/btrfs-reset-block-group-chunk-force-if-we-have-to-wait.patch
new file mode 100644 (file)
index 0000000..7f9c2c6
--- /dev/null
@@ -0,0 +1,37 @@
+From 1314ca78b2c35d3e7d0f097268a2ee6dc0d369ef Mon Sep 17 00:00:00 2001
+From: Josef Bacik <josef@toxicpanda.com>
+Date: Mon, 13 Jun 2022 18:31:17 -0400
+Subject: btrfs: reset block group chunk force if we have to wait
+
+From: Josef Bacik <josef@toxicpanda.com>
+
+commit 1314ca78b2c35d3e7d0f097268a2ee6dc0d369ef upstream.
+
+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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/block-group.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/fs/btrfs/block-group.c
++++ b/fs/btrfs/block-group.c
+@@ -2938,6 +2938,7 @@ int btrfs_chunk_alloc(struct btrfs_trans
+                        * attempt.
+                        */
+                       wait_for_alloc = true;
++                      force = CHUNK_ALLOC_NO_FORCE;
+                       spin_unlock(&space_info->lock);
+                       mutex_lock(&fs_info->chunk_mutex);
+                       mutex_unlock(&fs_info->chunk_mutex);
index 08d17f39971544662dec0e2c243a4bec16a881a5..aa5c468481b64505b676840ab0c7d21eb26e6bdc 100644 (file)
@@ -257,3 +257,4 @@ x86-olpc-fix-logical-not-is-only-applied-to-the-left-hand-side.patch
 spmi-trace-fix-stack-out-of-bound-access-in-spmi-tracing-functions.patch
 kexec-keys-s390-make-use-of-built-in-and-secondary-keyring-for-signature-verification.patch
 tpm-eventlog-fix-section-mismatch-for-debug_section_mismatch.patch
+btrfs-reset-block-group-chunk-force-if-we-have-to-wait.patch