Skip to content

Commit 9720906

Browse files
Luis Henriques (SUSE)tytso
authored andcommitted
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) <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]> Cc: [email protected]
1 parent dd589b0 commit 9720906

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/jbd2/checkpoint.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,12 @@ __releases(&journal->j_state_lock)
7979
if (space_left < nblocks) {
8080
int chkpt = journal->j_checkpoint_transactions != NULL;
8181
tid_t tid = 0;
82+
bool has_transaction = false;
8283

83-
if (journal->j_committing_transaction)
84+
if (journal->j_committing_transaction) {
8485
tid = journal->j_committing_transaction->t_tid;
86+
has_transaction = true;
87+
}
8588
spin_unlock(&journal->j_list_lock);
8689
write_unlock(&journal->j_state_lock);
8790
if (chkpt) {
@@ -92,7 +95,7 @@ __releases(&journal->j_state_lock)
9295
* journal was aborted due to an error.
9396
*/
9497
;
95-
} else if (tid) {
98+
} else if (has_transaction) {
9699
/*
97100
* jbd2_journal_commit_transaction() may want
98101
* to take the checkpoint_mutex if JBD2_FLUSHED

0 commit comments

Comments
 (0)