diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-01-10 12:46:59 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-01-10 12:46:59 -0500 |
commit | b40971426a837e9dc9c66e1b6bbcb3874eafe4e0 (patch) | |
tree | 34b2a745719ed18bd1f0c81cfad200b9d8b2e309 /fs/ext4/inode.c | |
parent | ca6e909f9bebe709bc65a3ee605ce32969db0452 (diff) |
ext4: add error checking to calls to ext4_handle_dirty_metadata()
Call ext4_std_error() in various places when we can't bail out
cleanly, so the file system can be marked as in error.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 2693fcda30d8..84b616269265 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -4185,6 +4185,7 @@ static int ext4_clear_blocks(handle_t *handle, struct inode *inode, | |||
4185 | { | 4185 | { |
4186 | __le32 *p; | 4186 | __le32 *p; |
4187 | int flags = EXT4_FREE_BLOCKS_FORGET | EXT4_FREE_BLOCKS_VALIDATED; | 4187 | int flags = EXT4_FREE_BLOCKS_FORGET | EXT4_FREE_BLOCKS_VALIDATED; |
4188 | int err; | ||
4188 | 4189 | ||
4189 | if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) | 4190 | if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) |
4190 | flags |= EXT4_FREE_BLOCKS_METADATA; | 4191 | flags |= EXT4_FREE_BLOCKS_METADATA; |
@@ -4200,11 +4201,23 @@ static int ext4_clear_blocks(handle_t *handle, struct inode *inode, | |||
4200 | if (try_to_extend_transaction(handle, inode)) { | 4201 | if (try_to_extend_transaction(handle, inode)) { |
4201 | if (bh) { | 4202 | if (bh) { |
4202 | BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata"); | 4203 | BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata"); |
4203 | ext4_handle_dirty_metadata(handle, inode, bh); | 4204 | err = ext4_handle_dirty_metadata(handle, inode, bh); |
4205 | if (unlikely(err)) { | ||
4206 | ext4_std_error(inode->i_sb, err); | ||
4207 | return 1; | ||
4208 | } | ||
4209 | } | ||
4210 | err = ext4_mark_inode_dirty(handle, inode); | ||
4211 | if (unlikely(err)) { | ||
4212 | ext4_std_error(inode->i_sb, err); | ||
4213 | return 1; | ||
4214 | } | ||
4215 | err = ext4_truncate_restart_trans(handle, inode, | ||
4216 | blocks_for_truncate(inode)); | ||
4217 | if (unlikely(err)) { | ||
4218 | ext4_std_error(inode->i_sb, err); | ||
4219 | return 1; | ||
4204 | } | 4220 | } |
4205 | ext4_mark_inode_dirty(handle, inode); | ||
4206 | ext4_truncate_restart_trans(handle, inode, | ||
4207 | blocks_for_truncate(inode)); | ||
4208 | if (bh) { | 4221 | if (bh) { |
4209 | BUFFER_TRACE(bh, "retaking write access"); | 4222 | BUFFER_TRACE(bh, "retaking write access"); |
4210 | ext4_journal_get_write_access(handle, bh); | 4223 | ext4_journal_get_write_access(handle, bh); |