aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2013-01-12 16:19:36 -0500
committerTheodore Ts'o <tytso@mit.edu>2013-01-12 16:19:36 -0500
commit860d21e2c585f7ee8a4ecc06f474fdc33c9474f4 (patch)
treef4b8f664599f043b7aa7b86a9a135aa275f0a5e2 /fs/ext4/inode.c
parent9931faca02c604c22335f5a935a501bb2ace6e20 (diff)
ext4: return ENOMEM if sb_getblk() fails
The only reason for sb_getblk() failing is if it can't allocate the buffer_head. So ENOMEM is more appropriate than EIO. In addition, make sure that the file system is marked as being inconsistent if sb_getblk() fails. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: stable@vger.kernel.org
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index cbfe13bf5b2a..9ccc140b82d2 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -714,7 +714,7 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
714 714
715 bh = sb_getblk(inode->i_sb, map.m_pblk); 715 bh = sb_getblk(inode->i_sb, map.m_pblk);
716 if (!bh) { 716 if (!bh) {
717 *errp = -EIO; 717 *errp = -ENOMEM;
718 return NULL; 718 return NULL;
719 } 719 }
720 if (map.m_flags & EXT4_MAP_NEW) { 720 if (map.m_flags & EXT4_MAP_NEW) {
@@ -3660,11 +3660,8 @@ static int __ext4_get_inode_loc(struct inode *inode,
3660 iloc->offset = (inode_offset % inodes_per_block) * EXT4_INODE_SIZE(sb); 3660 iloc->offset = (inode_offset % inodes_per_block) * EXT4_INODE_SIZE(sb);
3661 3661
3662 bh = sb_getblk(sb, block); 3662 bh = sb_getblk(sb, block);
3663 if (!bh) { 3663 if (!bh)
3664 EXT4_ERROR_INODE_BLOCK(inode, block, 3664 return -ENOMEM;
3665 "unable to read itable block");
3666 return -EIO;
3667 }
3668 if (!buffer_uptodate(bh)) { 3665 if (!buffer_uptodate(bh)) {
3669 lock_buffer(bh); 3666 lock_buffer(bh);
3670 3667