jbd2: protect all log tail updates with j_checkpoint_mutex
[pandora-kernel.git] / fs / jbd2 / commit.c
index bccb605..b6c3c14 100644 (file)
@@ -340,6 +340,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
        /* Do we need to erase the effects of a prior jbd2_journal_flush? */
        if (journal->j_flags & JBD2_FLUSHED) {
                jbd_debug(3, "super block updated\n");
+               mutex_lock(&journal->j_checkpoint_mutex);
                /*
                 * We hold j_checkpoint_mutex so tail cannot change under us.
                 * We don't need any special data guarantees for writing sb
@@ -350,6 +351,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
                                                journal->j_tail_sequence,
                                                journal->j_tail,
                                                WRITE_SYNC);
+               mutex_unlock(&journal->j_checkpoint_mutex);
        } else {
                jbd_debug(3, "superblock not updated\n");
        }