diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 7bd4b1d4224e..a93ce76b13ee 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -1099,7 +1099,7 @@ restart_loop: commit_transaction->t_state = T_COMMIT_CALLBACK; J_ASSERT(commit_transaction == journal->j_committing_transaction); - journal->j_commit_sequence = commit_transaction->t_tid; + WRITE_ONCE(journal->j_commit_sequence, commit_transaction->t_tid); journal->j_committing_transaction = NULL; commit_time = ktime_to_ns(ktime_sub(ktime_get(), start_time)); diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index b7c5819bfc41..7e4dd64464a3 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -717,17 +717,7 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid) /* Return 1 when transaction with given tid has already committed. */ int jbd2_transaction_committed(journal_t *journal, tid_t tid) { - int ret = 1; - - read_lock(&journal->j_state_lock); - if (journal->j_running_transaction && - journal->j_running_transaction->t_tid == tid) - ret = 0; - if (journal->j_committing_transaction && - journal->j_committing_transaction->t_tid == tid) - ret = 0; - read_unlock(&journal->j_state_lock); - return ret; + return tid_geq(READ_ONCE(journal->j_commit_sequence), tid); } EXPORT_SYMBOL(jbd2_transaction_committed);