summaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorTheodore Ts'o2013-01-12 22:19:36 +0100
committerTheodore Ts'o2013-01-12 22:19:36 +0100
commit860d21e2c585f7ee8a4ecc06f474fdc33c9474f4 (patch)
treef4b8f664599f043b7aa7b86a9a135aa275f0a5e2 /fs/ext4/inode.c
parentLinux 3.8-rc3 (diff)
downloadkernel-qcow2-linux-860d21e2c585f7ee8a4ecc06f474fdc33c9474f4.tar.gz
kernel-qcow2-linux-860d21e2c585f7ee8a4ecc06f474fdc33c9474f4.tar.xz
kernel-qcow2-linux-860d21e2c585f7ee8a4ecc06f474fdc33c9474f4.zip
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,
bh = sb_getblk(inode->i_sb, map.m_pblk);
if (!bh) {
- *errp = -EIO;
+ *errp = -ENOMEM;
return NULL;
}
if (map.m_flags & EXT4_MAP_NEW) {
@@ -3660,11 +3660,8 @@ static int __ext4_get_inode_loc(struct inode *inode,
iloc->offset = (inode_offset % inodes_per_block) * EXT4_INODE_SIZE(sb);
bh = sb_getblk(sb, block);
- if (!bh) {
- EXT4_ERROR_INODE_BLOCK(inode, block,
- "unable to read itable block");
- return -EIO;
- }
+ if (!bh)
+ return -ENOMEM;
if (!buffer_uptodate(bh)) {
lock_buffer(bh);