diff options
author | Theodore Ts'o <tytso@mit.edu> | 2013-01-12 16:19:36 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-11 16:10:06 -0700 |
commit | c28414d3497a0db41a9fb08650131ee15989ee9c (patch) | |
tree | ee7207a07f766bf45670c466ee2640a17d78e289 /fs/ext4/inode.c | |
parent | 0ef4c881e4ade7a45174d9cf45eca6f9e10f5ccc (diff) |
ext4: return ENOMEM if sb_getblk() fails
commit 860d21e2c585f7ee8a4ecc06f474fdc33c9474f4 upstream.
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>
[xr: Backported to 3.4:
- Drop change to inline.c
- Call to ext4_ext_check() from ext4_ext_find_extent() is conditional]
Signed-off-by: Rui Xiang <rui.xiang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index f2fd71c94bb6..25264c4d390f 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -663,7 +663,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) { @@ -3461,11 +3461,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); |