提交 6c20ec85 编写于 作者: T Theodore Ts'o

jbd2: Call the commit callback before the transaction could get dropped

The transaction can potentially get dropped if there are no buffers
that need to be written.  Make sure we call the commit callback before
potentially deciding to drop the transaction.  Also avoid
dereferencing the commit_transaction pointer in the marker for the
same reason.

This patch fixes the bug reported by Eric Paris at:
http://bugzilla.kernel.org/show_bug.cgi?id=11838Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
Acked-by: NEric Sandeen <sandeen@redhat.com>
Tested-by: NEric Paris <eparis@redhat.com>
上级 ef2cabf7
...@@ -974,6 +974,9 @@ void jbd2_journal_commit_transaction(journal_t *journal) ...@@ -974,6 +974,9 @@ void jbd2_journal_commit_transaction(journal_t *journal)
journal->j_committing_transaction = NULL; journal->j_committing_transaction = NULL;
spin_unlock(&journal->j_state_lock); spin_unlock(&journal->j_state_lock);
if (journal->j_commit_callback)
journal->j_commit_callback(journal, commit_transaction);
if (commit_transaction->t_checkpoint_list == NULL && if (commit_transaction->t_checkpoint_list == NULL &&
commit_transaction->t_checkpoint_io_list == NULL) { commit_transaction->t_checkpoint_io_list == NULL) {
__jbd2_journal_drop_transaction(journal, commit_transaction); __jbd2_journal_drop_transaction(journal, commit_transaction);
...@@ -995,11 +998,8 @@ void jbd2_journal_commit_transaction(journal_t *journal) ...@@ -995,11 +998,8 @@ void jbd2_journal_commit_transaction(journal_t *journal)
} }
spin_unlock(&journal->j_list_lock); spin_unlock(&journal->j_list_lock);
if (journal->j_commit_callback)
journal->j_commit_callback(journal, commit_transaction);
trace_mark(jbd2_end_commit, "dev %s transaction %d head %d", trace_mark(jbd2_end_commit, "dev %s transaction %d head %d",
journal->j_devname, commit_transaction->t_tid, journal->j_devname, journal->j_commit_sequence,
journal->j_tail_sequence); journal->j_tail_sequence);
jbd_debug(1, "JBD: commit %d complete, head %d\n", jbd_debug(1, "JBD: commit %d complete, head %d\n",
journal->j_commit_sequence, journal->j_tail_sequence); journal->j_commit_sequence, journal->j_tail_sequence);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册