diff options
author | Jeff Mahoney <jeffm@suse.com> | 2005-12-14 14:38:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-12-14 21:56:07 -0500 |
commit | 5d5e815618c4a8b53806845268c951201d14af6e (patch) | |
tree | 5515610e7747c52d20fe20ea4bc48186b2ff7ac0 /fs | |
parent | ea54c96c04cfd9fec881e403d8f7931b47f7b2a6 (diff) |
[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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/reiserfs/journal.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 68b7b78638ff..3f17ef844fb6 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -1039,6 +1039,10 @@ static int flush_commit_list(struct super_block *s, | |||
1039 | } | 1039 | } |
1040 | atomic_dec(&journal->j_async_throttle); | 1040 | atomic_dec(&journal->j_async_throttle); |
1041 | 1041 | ||
1042 | /* We're skipping the commit if there's an error */ | ||
1043 | if (retval || reiserfs_is_journal_aborted(journal)) | ||
1044 | barrier = 0; | ||
1045 | |||
1042 | /* wait on everything written so far before writing the commit | 1046 | /* wait on everything written so far before writing the commit |
1043 | * if we are in barrier mode, send the commit down now | 1047 | * if we are in barrier mode, send the commit down now |
1044 | */ | 1048 | */ |
@@ -1077,10 +1081,16 @@ static int flush_commit_list(struct super_block *s, | |||
1077 | BUG_ON(atomic_read(&(jl->j_commit_left)) != 1); | 1081 | BUG_ON(atomic_read(&(jl->j_commit_left)) != 1); |
1078 | 1082 | ||
1079 | if (!barrier) { | 1083 | if (!barrier) { |
1080 | if (buffer_dirty(jl->j_commit_bh)) | 1084 | /* If there was a write error in the journal - we can't commit |
1081 | BUG(); | 1085 | * this transaction - it will be invalid and, if successful, |
1082 | mark_buffer_dirty(jl->j_commit_bh); | 1086 | * will just end up propogating the write error out to |
1083 | sync_dirty_buffer(jl->j_commit_bh); | 1087 | * the file system. */ |
1088 | if (likely(!retval && !reiserfs_is_journal_aborted (journal))) { | ||
1089 | if (buffer_dirty(jl->j_commit_bh)) | ||
1090 | BUG(); | ||
1091 | mark_buffer_dirty(jl->j_commit_bh) ; | ||
1092 | sync_dirty_buffer(jl->j_commit_bh) ; | ||
1093 | } | ||
1084 | } else | 1094 | } else |
1085 | wait_on_buffer(jl->j_commit_bh); | 1095 | wait_on_buffer(jl->j_commit_bh); |
1086 | 1096 | ||