mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-26 07:44:27 +08:00
[PATCH] reiserfs: skip commit on io error
This should have been part of the original io error patch, but got dropped somewhere along the way. It's extremely important when handling the i/o error in the journal to not commit the transaction with corrupt data. This patch adds that code back in. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
ea54c96c04
commit
5d5e815618
@ -1039,6 +1039,10 @@ static int flush_commit_list(struct super_block *s,
|
|||||||
}
|
}
|
||||||
atomic_dec(&journal->j_async_throttle);
|
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
|
/* wait on everything written so far before writing the commit
|
||||||
* if we are in barrier mode, send the commit down now
|
* 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);
|
BUG_ON(atomic_read(&(jl->j_commit_left)) != 1);
|
||||||
|
|
||||||
if (!barrier) {
|
if (!barrier) {
|
||||||
if (buffer_dirty(jl->j_commit_bh))
|
/* If there was a write error in the journal - we can't commit
|
||||||
BUG();
|
* this transaction - it will be invalid and, if successful,
|
||||||
mark_buffer_dirty(jl->j_commit_bh);
|
* will just end up propogating the write error out to
|
||||||
sync_dirty_buffer(jl->j_commit_bh);
|
* 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
|
} else
|
||||||
wait_on_buffer(jl->j_commit_bh);
|
wait_on_buffer(jl->j_commit_bh);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user