diff options
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/inode.c | 26 | ||||
-rw-r--r-- | fs/reiserfs/journal.c | 18 |
2 files changed, 32 insertions, 12 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 0a044ad98885..a5e3a0ddbe53 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -32,6 +32,7 @@ void reiserfs_delete_inode(struct inode *inode) | |||
32 | JOURNAL_PER_BALANCE_CNT * 2 + | 32 | JOURNAL_PER_BALANCE_CNT * 2 + |
33 | 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb); | 33 | 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb); |
34 | struct reiserfs_transaction_handle th; | 34 | struct reiserfs_transaction_handle th; |
35 | int err; | ||
35 | 36 | ||
36 | truncate_inode_pages(&inode->i_data, 0); | 37 | truncate_inode_pages(&inode->i_data, 0); |
37 | 38 | ||
@@ -49,15 +50,13 @@ void reiserfs_delete_inode(struct inode *inode) | |||
49 | } | 50 | } |
50 | reiserfs_update_inode_transaction(inode); | 51 | reiserfs_update_inode_transaction(inode); |
51 | 52 | ||
52 | if (reiserfs_delete_object(&th, inode)) { | 53 | err = reiserfs_delete_object(&th, inode); |
53 | up(&inode->i_sem); | ||
54 | goto out; | ||
55 | } | ||
56 | 54 | ||
57 | /* Do quota update inside a transaction for journaled quotas. We must do that | 55 | /* Do quota update inside a transaction for journaled quotas. We must do that |
58 | * after delete_object so that quota updates go into the same transaction as | 56 | * after delete_object so that quota updates go into the same transaction as |
59 | * stat data deletion */ | 57 | * stat data deletion */ |
60 | DQUOT_FREE_INODE(inode); | 58 | if (!err) |
59 | DQUOT_FREE_INODE(inode); | ||
61 | 60 | ||
62 | if (journal_end(&th, inode->i_sb, jbegin_count)) { | 61 | if (journal_end(&th, inode->i_sb, jbegin_count)) { |
63 | up(&inode->i_sem); | 62 | up(&inode->i_sem); |
@@ -66,6 +65,12 @@ void reiserfs_delete_inode(struct inode *inode) | |||
66 | 65 | ||
67 | up(&inode->i_sem); | 66 | up(&inode->i_sem); |
68 | 67 | ||
68 | /* check return value from reiserfs_delete_object after | ||
69 | * ending the transaction | ||
70 | */ | ||
71 | if (err) | ||
72 | goto out; | ||
73 | |||
69 | /* all items of file are deleted, so we can remove "save" link */ | 74 | /* all items of file are deleted, so we can remove "save" link */ |
70 | remove_save_link(inode, 0 /* not truncate */ ); /* we can't do anything | 75 | remove_save_link(inode, 0 /* not truncate */ ); /* we can't do anything |
71 | * about an error here */ | 76 | * about an error here */ |
@@ -2099,6 +2104,7 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps) | |||
2099 | struct page *page = NULL; | 2104 | struct page *page = NULL; |
2100 | int error; | 2105 | int error; |
2101 | struct buffer_head *bh = NULL; | 2106 | struct buffer_head *bh = NULL; |
2107 | int err2; | ||
2102 | 2108 | ||
2103 | reiserfs_write_lock(p_s_inode->i_sb); | 2109 | reiserfs_write_lock(p_s_inode->i_sb); |
2104 | 2110 | ||
@@ -2136,14 +2142,18 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps) | |||
2136 | transaction of truncating gets committed - on reboot the file | 2142 | transaction of truncating gets committed - on reboot the file |
2137 | either appears truncated properly or not truncated at all */ | 2143 | either appears truncated properly or not truncated at all */ |
2138 | add_save_link(&th, p_s_inode, 1); | 2144 | add_save_link(&th, p_s_inode, 1); |
2139 | error = reiserfs_do_truncate(&th, p_s_inode, page, update_timestamps); | 2145 | err2 = reiserfs_do_truncate(&th, p_s_inode, page, update_timestamps); |
2140 | if (error) | ||
2141 | goto out; | ||
2142 | error = | 2146 | error = |
2143 | journal_end(&th, p_s_inode->i_sb, JOURNAL_PER_BALANCE_CNT * 2 + 1); | 2147 | journal_end(&th, p_s_inode->i_sb, JOURNAL_PER_BALANCE_CNT * 2 + 1); |
2144 | if (error) | 2148 | if (error) |
2145 | goto out; | 2149 | goto out; |
2146 | 2150 | ||
2151 | /* check reiserfs_do_truncate after ending the transaction */ | ||
2152 | if (err2) { | ||
2153 | error = err2; | ||
2154 | goto out; | ||
2155 | } | ||
2156 | |||
2147 | if (update_timestamps) { | 2157 | if (update_timestamps) { |
2148 | error = remove_save_link(p_s_inode, 1 /* truncate */ ); | 2158 | error = remove_save_link(p_s_inode, 1 /* truncate */ ); |
2149 | if (error) | 2159 | if (error) |
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 | ||