diff options
author | Luis Henriques (SUSE) <luis.henriques@linux.dev> | 2024-07-24 19:11:16 +0300 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2024-08-27 06:39:42 +0300 |
commit | 972090651ee15e51abfb2160e986fa050cfc7a40 (patch) | |
tree | b43e7357c7cd19d6e288d9fec0c2309157909ece | |
parent | dd589b0f1445e1ea1085b98edca6e4d5dedb98d0 (diff) | |
download | linux-972090651ee15e51abfb2160e986fa050cfc7a40.tar.xz |
ext4: fix incorrect tid assumption in __jbd2_log_wait_for_space()
Function __jbd2_log_wait_for_space() assumes that '0' is not a valid value
for transaction IDs, which is incorrect. Don't assume that and invoke
jbd2_log_wait_commit() if the journal had a committing transaction instead.
Signed-off-by: Luis Henriques (SUSE) <luis.henriques@linux.dev>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20240724161119.13448-3-luis.henriques@linux.dev
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
-rw-r--r-- | fs/jbd2/checkpoint.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c index 7b593591273a..bd34083d5fa2 100644 --- a/fs/jbd2/checkpoint.c +++ b/fs/jbd2/checkpoint.c @@ -79,9 +79,12 @@ __releases(&journal->j_state_lock) if (space_left < nblocks) { int chkpt = journal->j_checkpoint_transactions != NULL; tid_t tid = 0; + bool has_transaction = false; - if (journal->j_committing_transaction) + if (journal->j_committing_transaction) { tid = journal->j_committing_transaction->t_tid; + has_transaction = true; + } spin_unlock(&journal->j_list_lock); write_unlock(&journal->j_state_lock); if (chkpt) { @@ -92,7 +95,7 @@ __releases(&journal->j_state_lock) * journal was aborted due to an error. */ ; - } else if (tid) { + } else if (has_transaction) { /* * jbd2_journal_commit_transaction() may want * to take the checkpoint_mutex if JBD2_FLUSHED |