diff options
-rw-r--r-- | fs/jbd/journal.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index 9e4fa52d7dc8..e79c07812afa 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c | |||
@@ -427,7 +427,7 @@ int __log_space_left(journal_t *journal) | |||
427 | } | 427 | } |
428 | 428 | ||
429 | /* | 429 | /* |
430 | * Called under j_state_lock. Returns true if a transaction was started. | 430 | * Called under j_state_lock. Returns true if a transaction commit was started. |
431 | */ | 431 | */ |
432 | int __log_start_commit(journal_t *journal, tid_t target) | 432 | int __log_start_commit(journal_t *journal, tid_t target) |
433 | { | 433 | { |
@@ -495,7 +495,8 @@ int journal_force_commit_nested(journal_t *journal) | |||
495 | 495 | ||
496 | /* | 496 | /* |
497 | * Start a commit of the current running transaction (if any). Returns true | 497 | * Start a commit of the current running transaction (if any). Returns true |
498 | * if a transaction was started, and fills its tid in at *ptid | 498 | * if a transaction is going to be committed (or is currently already |
499 | * committing), and fills its tid in at *ptid | ||
499 | */ | 500 | */ |
500 | int journal_start_commit(journal_t *journal, tid_t *ptid) | 501 | int journal_start_commit(journal_t *journal, tid_t *ptid) |
501 | { | 502 | { |
@@ -505,15 +506,19 @@ int journal_start_commit(journal_t *journal, tid_t *ptid) | |||
505 | if (journal->j_running_transaction) { | 506 | if (journal->j_running_transaction) { |
506 | tid_t tid = journal->j_running_transaction->t_tid; | 507 | tid_t tid = journal->j_running_transaction->t_tid; |
507 | 508 | ||
508 | ret = __log_start_commit(journal, tid); | 509 | __log_start_commit(journal, tid); |
509 | if (ret && ptid) | 510 | /* There's a running transaction and we've just made sure |
511 | * it's commit has been scheduled. */ | ||
512 | if (ptid) | ||
510 | *ptid = tid; | 513 | *ptid = tid; |
511 | } else if (journal->j_committing_transaction && ptid) { | 514 | ret = 1; |
515 | } else if (journal->j_committing_transaction) { | ||
512 | /* | 516 | /* |
513 | * If ext3_write_super() recently started a commit, then we | 517 | * If ext3_write_super() recently started a commit, then we |
514 | * have to wait for completion of that transaction | 518 | * have to wait for completion of that transaction |
515 | */ | 519 | */ |
516 | *ptid = journal->j_committing_transaction->t_tid; | 520 | if (ptid) |
521 | *ptid = journal->j_committing_transaction->t_tid; | ||
517 | ret = 1; | 522 | ret = 1; |
518 | } | 523 | } |
519 | spin_unlock(&journal->j_state_lock); | 524 | spin_unlock(&journal->j_state_lock); |