diff options
-rw-r--r-- | fs/jbd/journal.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index b3713afaaa9e..e2d4285fbe90 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c | |||
@@ -437,9 +437,12 @@ int __log_space_left(journal_t *journal) | |||
437 | int __log_start_commit(journal_t *journal, tid_t target) | 437 | int __log_start_commit(journal_t *journal, tid_t target) |
438 | { | 438 | { |
439 | /* | 439 | /* |
440 | * Are we already doing a recent enough commit? | 440 | * The only transaction we can possibly wait upon is the |
441 | * currently running transaction (if it exists). Otherwise, | ||
442 | * the target tid must be an old one. | ||
441 | */ | 443 | */ |
442 | if (!tid_geq(journal->j_commit_request, target)) { | 444 | if (journal->j_running_transaction && |
445 | journal->j_running_transaction->t_tid == target) { | ||
443 | /* | 446 | /* |
444 | * We want a new commit: OK, mark the request and wakeup the | 447 | * We want a new commit: OK, mark the request and wakeup the |
445 | * commit thread. We do _not_ do the commit ourselves. | 448 | * commit thread. We do _not_ do the commit ourselves. |
@@ -451,7 +454,14 @@ int __log_start_commit(journal_t *journal, tid_t target) | |||
451 | journal->j_commit_sequence); | 454 | journal->j_commit_sequence); |
452 | wake_up(&journal->j_wait_commit); | 455 | wake_up(&journal->j_wait_commit); |
453 | return 1; | 456 | return 1; |
454 | } | 457 | } else if (!tid_geq(journal->j_commit_request, target)) |
458 | /* This should never happen, but if it does, preserve | ||
459 | the evidence before kjournald goes into a loop and | ||
460 | increments j_commit_sequence beyond all recognition. */ | ||
461 | WARN_ONCE(1, "jbd: bad log_start_commit: %u %u %u %u\n", | ||
462 | journal->j_commit_request, journal->j_commit_sequence, | ||
463 | target, journal->j_running_transaction ? | ||
464 | journal->j_running_transaction->t_tid : 0); | ||
455 | return 0; | 465 | return 0; |
456 | } | 466 | } |
457 | 467 | ||