Skip to content

Commit bd87b99

Browse files
Luis Henriques (SUSE)gregkh
authored andcommitted
ext4: fix incorrect tid assumption in __jbd2_log_wait_for_space()
commit 9720906 upstream. 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] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent abfaa87 commit bd87b99

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
@@ -91,17 +91,20 @@ __releases(&journal->j_state_lock)
9191
if (space_left < nblocks) {
9292
int chkpt = journal->j_checkpoint_transactions != NULL;
9393
tid_t tid = 0;
94+
bool has_transaction = false;
9495

95-
if (journal->j_committing_transaction)
96+
if (journal->j_committing_transaction) {
9697
tid = journal->j_committing_transaction->t_tid;
98+
has_transaction = true;
99+
}
97100
spin_unlock(&journal->j_list_lock);
98101
write_unlock(&journal->j_state_lock);
99102
if (chkpt) {
100103
jbd2_log_do_checkpoint(journal);
101104
} else if (jbd2_cleanup_journal_tail(journal) == 0) {
102105
/* We were able to recover space; yay! */
103106
;
104-
} else if (tid) {
107+
} else if (has_transaction) {
105108
/*
106109
* jbd2_journal_commit_transaction() may want
107110
* to take the checkpoint_mutex if JBD2_FLUSHED

0 commit comments

Comments
 (0)