X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=fs%2Freiserfs%2Fjournal.c;h=4491fcf2a0e60b55ca66d61f222b4a807ca0b385;hb=e2f99018eb7b29954747a2dd78e9fc0c36a60f0f;hp=68b7b78638ff0e1bf050000f1c3e201a24584dd6;hpb=606c0dafbe88102d64c1253caed8a2c36987070f;p=linux-2.6 diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 68b7b78638..4491fcf2a0 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c @@ -1039,6 +1039,10 @@ static int flush_commit_list(struct super_block *s, } atomic_dec(&journal->j_async_throttle); + /* We're skipping the commit if there's an error */ + if (retval || reiserfs_is_journal_aborted(journal)) + barrier = 0; + /* wait on everything written so far before writing the commit * if we are in barrier mode, send the commit down now */ @@ -1077,10 +1081,16 @@ static int flush_commit_list(struct super_block *s, BUG_ON(atomic_read(&(jl->j_commit_left)) != 1); if (!barrier) { - if (buffer_dirty(jl->j_commit_bh)) - BUG(); - mark_buffer_dirty(jl->j_commit_bh); - sync_dirty_buffer(jl->j_commit_bh); + /* If there was a write error in the journal - we can't commit + * this transaction - it will be invalid and, if successful, + * will just end up propogating the write error out to + * the file system. */ + if (likely(!retval && !reiserfs_is_journal_aborted (journal))) { + if (buffer_dirty(jl->j_commit_bh)) + BUG(); + mark_buffer_dirty(jl->j_commit_bh) ; + sync_dirty_buffer(jl->j_commit_bh) ; + } } else wait_on_buffer(jl->j_commit_bh); @@ -3915,10 +3925,13 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, flush = 1; } #ifdef REISERFS_PREALLOCATE - /* quota ops might need to nest, setup the journal_info pointer for them */ + /* quota ops might need to nest, setup the journal_info pointer for them + * and raise the refcount so that it is > 0. */ current->journal_info = th; + th->t_refcount++; reiserfs_discard_all_prealloc(th); /* it should not involve new blocks into * the transaction */ + th->t_refcount--; current->journal_info = th->t_handle_save; #endif