From addfdb312e0b95ee4778cbab0320bb55204d4c8b Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sat, 2 Feb 2008 12:28:19 -0500 Subject: [PATCH] Add bugfix patch: add_error_check_to_journal_wait_on_commit_record --- add_error_check_to_journal_wait_on_commit_record | 32 ++++++++++++++++++++++++ series | 1 + 2 files changed, 33 insertions(+) create mode 100644 add_error_check_to_journal_wait_on_commit_record diff --git a/add_error_check_to_journal_wait_on_commit_record b/add_error_check_to_journal_wait_on_commit_record new file mode 100644 index 00000000..6a26538b --- /dev/null +++ b/add_error_check_to_journal_wait_on_commit_record @@ -0,0 +1,32 @@ +jbd2: Add error check to journal_wait_on_commit_record to avoid oops + +The buffer head pointer passed to journal_wait_on_commit_record() could +be NULL if the previous journal_submit_commit_record() failed or journal +has already aborted. + +Looking at the jbd2 debug messages, before the oops happened, the jbd2 +is aborted due to trying to access the next log block beyond the end +of device. This might be caused by using a corrupted image. + +We need to check the error returns from journal_submit_commit_record() +and avoid calling journal_wait_on_commit_record() in the failure case. + +This addresses Kernel Bugzilla #9849 + +Signed-off-by: Mingming Cao +Signed-off-by: "Theodore Ts'o" + +diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c +index 4f302d2..48b3cb8 100644 +--- a/fs/jbd2/commit.c ++++ b/fs/jbd2/commit.c +@@ -872,7 +872,8 @@ wait_for_iobuf: + if (err) + __jbd2_journal_abort_hard(journal); + } +- err = journal_wait_on_commit_record(cbh); ++ if (!err && !is_journal_aborted(journal)) ++ err = journal_wait_on_commit_record(cbh); + + if (err) + jbd2_journal_abort(journal, err); diff --git a/series b/series index 6496b063..dd5f42f4 100644 --- a/series +++ b/series @@ -1,6 +1,7 @@ # This series applies on 2.6.24-git12 replace-iget-with-iget-unlocked +add_error_check_to_journal_wait_on_commit_record jbd_remove_useless_loop_when_writing_commit_record jbd_fix_assertion_failure_in_journal_next_log_block.patch -- 2.11.4.GIT