25-akpm/fs/jbd/commit.c | 9 ++++++--- 25-akpm/fs/jbd/journal.c | 5 ++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff -puN fs/jbd/commit.c~jbd-handle-journal-io-errors-fix fs/jbd/commit.c --- 25/fs/jbd/commit.c~jbd-handle-journal-io-errors-fix Wed Mar 26 17:37:04 2003 +++ 25-akpm/fs/jbd/commit.c Wed Mar 26 17:37:04 2003 @@ -297,11 +297,13 @@ write_out_data_locked: jh = jh->b_tprev; /* Wait on the last written */ bh = jh2bh(jh); if (buffer_locked(bh)) { + get_bh(bh); spin_unlock(&journal_datalist_lock); unlock_journal(journal); wait_on_buffer(bh); if (unlikely(!buffer_uptodate(bh))) err = -EIO; + put_bh(bh); /* the journal_head may have been removed now */ lock_journal(journal); goto write_out_data; @@ -494,7 +496,10 @@ start_journal_io: jbd_debug(3, "JBD: commit phase 4\n"); - /* akpm: these are BJ_IO, and journal_datalist_lock is not needed */ + /* + * akpm: these are BJ_IO, and journal_datalist_lock is not needed. + * See __journal_try_to_free_buffer. + */ wait_for_iobuf: while (commit_transaction->t_iobuf_list != NULL) { struct buffer_head *bh; @@ -505,8 +510,6 @@ start_journal_io: wait_on_buffer(bh); if (unlikely(!buffer_uptodate(bh))) err = -EIO; - if (unlikely(!buffer_uptodate(bh))) - err = -EIO; lock_journal(journal); goto wait_for_iobuf; } diff -puN fs/jbd/journal.c~jbd-handle-journal-io-errors-fix fs/jbd/journal.c --- 25/fs/jbd/journal.c~jbd-handle-journal-io-errors-fix Wed Mar 26 17:37:04 2003 +++ 25-akpm/fs/jbd/journal.c Wed Mar 26 17:37:04 2003 @@ -582,7 +582,8 @@ out: */ int log_wait_commit (journal_t *journal, tid_t tid) { - int err; + int err = 0; + lock_kernel(); #ifdef CONFIG_JBD_DEBUG lock_journal(journal); @@ -603,8 +604,6 @@ int log_wait_commit (journal_t *journal, if (unlikely(is_journal_aborted(journal))) { printk(KERN_EMERG "journal commit I/O error\n"); err = -EIO; - } else { - err = 0; } unlock_kernel(); _