aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd2/commit.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2008-10-28 21:08:20 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-10-28 21:08:20 -0400
commit6c20ec850360bc6e5c66a787f0523a80450d65ab (patch)
tree567f496cf53dbfbc235809edac134e0247a062c8 /fs/jbd2/commit.c
parentef2cabf7c6d838eb0ee2b4fb8ef84f7c06ce16d9 (diff)
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=11838 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Acked-by: Eric Sandeen <sandeen@redhat.com> Tested-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/jbd2/commit.c')
-rw-r--r--fs/jbd2/commit.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 8b119e16aa36..ebc667bc54a8 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -974,6 +974,9 @@ restart_loop:
974 journal->j_committing_transaction = NULL; 974 journal->j_committing_transaction = NULL;
975 spin_unlock(&journal->j_state_lock); 975 spin_unlock(&journal->j_state_lock);
976 976
977 if (journal->j_commit_callback)
978 journal->j_commit_callback(journal, commit_transaction);
979
977 if (commit_transaction->t_checkpoint_list == NULL && 980 if (commit_transaction->t_checkpoint_list == NULL &&
978 commit_transaction->t_checkpoint_io_list == NULL) { 981 commit_transaction->t_checkpoint_io_list == NULL) {
979 __jbd2_journal_drop_transaction(journal, commit_transaction); 982 __jbd2_journal_drop_transaction(journal, commit_transaction);
@@ -995,11 +998,8 @@ restart_loop:
995 } 998 }
996 spin_unlock(&journal->j_list_lock); 999 spin_unlock(&journal->j_list_lock);
997 1000
998 if (journal->j_commit_callback)
999 journal->j_commit_callback(journal, commit_transaction);
1000
1001 trace_mark(jbd2_end_commit, "dev %s transaction %d head %d", 1001 trace_mark(jbd2_end_commit, "dev %s transaction %d head %d",
1002 journal->j_devname, commit_transaction->t_tid, 1002 journal->j_devname, journal->j_commit_sequence,
1003 journal->j_tail_sequence); 1003 journal->j_tail_sequence);
1004 jbd_debug(1, "JBD: commit %d complete, head %d\n", 1004 jbd_debug(1, "JBD: commit %d complete, head %d\n",
1005 journal->j_commit_sequence, journal->j_tail_sequence); 1005 journal->j_commit_sequence, journal->j_tail_sequence);