]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Oct 2022 13:08:44 +0000 (15:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Oct 2022 13:08:44 +0000 (15:08 +0200)
added patches:
jbd2-wake-up-journal-waiters-in-fifo-order-not-lifo.patch

queue-5.4/jbd2-wake-up-journal-waiters-in-fifo-order-not-lifo.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/jbd2-wake-up-journal-waiters-in-fifo-order-not-lifo.patch b/queue-5.4/jbd2-wake-up-journal-waiters-in-fifo-order-not-lifo.patch
new file mode 100644 (file)
index 0000000..6a47e06
--- /dev/null
@@ -0,0 +1,66 @@
+From 34fc8768ec6089565d6d73bad26724083cecf7bd Mon Sep 17 00:00:00 2001
+From: Andrew Perepechko <anserper@ya.ru>
+Date: Wed, 7 Sep 2022 19:59:59 +0300
+Subject: jbd2: wake up journal waiters in FIFO order, not LIFO
+
+From: Andrew Perepechko <anserper@ya.ru>
+
+commit 34fc8768ec6089565d6d73bad26724083cecf7bd upstream.
+
+LIFO wakeup order is unfair and sometimes leads to a journal
+user not being able to get a journal handle for hundreds of
+transactions in a row.
+
+FIFO wakeup can make things more fair.
+
+Cc: stable@kernel.org
+Signed-off-by: Alexey Lyashkov <alexey.lyashkov@gmail.com>
+Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
+Link: https://lore.kernel.org/r/20220907165959.1137482-1-alexey.lyashkov@gmail.com
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/jbd2/commit.c      |    2 +-
+ fs/jbd2/transaction.c |    6 +++---
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+--- a/fs/jbd2/commit.c
++++ b/fs/jbd2/commit.c
+@@ -531,7 +531,7 @@ void jbd2_journal_commit_transaction(jou
+       journal->j_running_transaction = NULL;
+       start_time = ktime_get();
+       commit_transaction->t_log_start = journal->j_head;
+-      wake_up(&journal->j_wait_transaction_locked);
++      wake_up_all(&journal->j_wait_transaction_locked);
+       write_unlock(&journal->j_state_lock);
+       jbd_debug(3, "JBD2: commit phase 2a\n");
+--- a/fs/jbd2/transaction.c
++++ b/fs/jbd2/transaction.c
+@@ -149,7 +149,7 @@ static void wait_transaction_locked(jour
+       int need_to_start;
+       tid_t tid = journal->j_running_transaction->t_tid;
+-      prepare_to_wait(&journal->j_wait_transaction_locked, &wait,
++      prepare_to_wait_exclusive(&journal->j_wait_transaction_locked, &wait,
+                       TASK_UNINTERRUPTIBLE);
+       need_to_start = !tid_geq(journal->j_commit_request, tid);
+       read_unlock(&journal->j_state_lock);
+@@ -175,7 +175,7 @@ static void wait_transaction_switching(j
+               read_unlock(&journal->j_state_lock);
+               return;
+       }
+-      prepare_to_wait(&journal->j_wait_transaction_locked, &wait,
++      prepare_to_wait_exclusive(&journal->j_wait_transaction_locked, &wait,
+                       TASK_UNINTERRUPTIBLE);
+       read_unlock(&journal->j_state_lock);
+       /*
+@@ -810,7 +810,7 @@ void jbd2_journal_unlock_updates (journa
+       write_lock(&journal->j_state_lock);
+       --journal->j_barrier_count;
+       write_unlock(&journal->j_state_lock);
+-      wake_up(&journal->j_wait_transaction_locked);
++      wake_up_all(&journal->j_wait_transaction_locked);
+ }
+ static void warn_dirty_buffer(struct buffer_head *bh)
index 442626206de132492c6316121fd0c285c71506c9..e461885da0b4f8fa0b73eba2f424db9e45f63fd0 100644 (file)
@@ -37,3 +37,4 @@ f2fs-increase-the-limit-for-reserve_root.patch
 f2fs-fix-to-do-sanity-check-on-destination-blkaddr-during-recovery.patch
 f2fs-fix-to-do-sanity-check-on-summary-info.patch
 nilfs2-fix-use-after-free-bug-of-struct-nilfs_root.patch
+jbd2-wake-up-journal-waiters-in-fifo-order-not-lifo.patch