From: Greg Kroah-Hartman Date: Sun, 16 Oct 2022 13:08:44 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v5.4.219~116 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4aaca3e09badf650fafbe905e1c9efd9713acb85;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: jbd2-wake-up-journal-waiters-in-fifo-order-not-lifo.patch --- 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 index 00000000000..6a47e06099d --- /dev/null +++ b/queue-5.4/jbd2-wake-up-journal-waiters-in-fifo-order-not-lifo.patch @@ -0,0 +1,66 @@ +From 34fc8768ec6089565d6d73bad26724083cecf7bd Mon Sep 17 00:00:00 2001 +From: Andrew Perepechko +Date: Wed, 7 Sep 2022 19:59:59 +0300 +Subject: jbd2: wake up journal waiters in FIFO order, not LIFO + +From: Andrew Perepechko + +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 +Reviewed-by: Ritesh Harjani (IBM) +Link: https://lore.kernel.org/r/20220907165959.1137482-1-alexey.lyashkov@gmail.com +Signed-off-by: Theodore Ts'o +Signed-off-by: Greg Kroah-Hartman +--- + 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) diff --git a/queue-5.4/series b/queue-5.4/series index 442626206de..e461885da0b 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -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