diff options
Diffstat (limited to 'fs/jbd')
-rw-r--r-- | fs/jbd/journal.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index 81cc7eaff863..81880c6d6b5e 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c | |||
@@ -564,6 +564,16 @@ int log_wait_commit(journal_t *journal, tid_t tid) | |||
564 | spin_unlock(&journal->j_state_lock); | 564 | spin_unlock(&journal->j_state_lock); |
565 | #endif | 565 | #endif |
566 | spin_lock(&journal->j_state_lock); | 566 | spin_lock(&journal->j_state_lock); |
567 | /* | ||
568 | * Not running or committing trans? Must be already committed. This | ||
569 | * saves us from waiting for a *long* time when tid overflows. | ||
570 | */ | ||
571 | if (!((journal->j_running_transaction && | ||
572 | journal->j_running_transaction->t_tid == tid) || | ||
573 | (journal->j_committing_transaction && | ||
574 | journal->j_committing_transaction->t_tid == tid))) | ||
575 | goto out_unlock; | ||
576 | |||
567 | if (!tid_geq(journal->j_commit_waited, tid)) | 577 | if (!tid_geq(journal->j_commit_waited, tid)) |
568 | journal->j_commit_waited = tid; | 578 | journal->j_commit_waited = tid; |
569 | while (tid_gt(tid, journal->j_commit_sequence)) { | 579 | while (tid_gt(tid, journal->j_commit_sequence)) { |
@@ -575,6 +585,7 @@ int log_wait_commit(journal_t *journal, tid_t tid) | |||
575 | !tid_gt(tid, journal->j_commit_sequence)); | 585 | !tid_gt(tid, journal->j_commit_sequence)); |
576 | spin_lock(&journal->j_state_lock); | 586 | spin_lock(&journal->j_state_lock); |
577 | } | 587 | } |
588 | out_unlock: | ||
578 | spin_unlock(&journal->j_state_lock); | 589 | spin_unlock(&journal->j_state_lock); |
579 | 590 | ||
580 | if (unlikely(is_journal_aborted(journal))) { | 591 | if (unlikely(is_journal_aborted(journal))) { |