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/resize.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/resize.c')
-rw-r--r-- | fs/ext4/resize.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 4affb40a6841..50992c3025c2 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -315,7 +315,7 @@ static struct buffer_head *bclean(handle_t *handle, struct super_block *sb, bh = sb_getblk(sb, blk); if (!bh) - return ERR_PTR(-EIO); + return ERR_PTR(-ENOMEM); if ((err = ext4_journal_get_write_access(handle, bh))) { brelse(bh); bh = ERR_PTR(err); @@ -392,7 +392,7 @@ static int set_flexbg_block_bitmap(struct super_block *sb, handle_t *handle, bh = sb_getblk(sb, flex_gd->groups[group].block_bitmap); if (!bh) - return -EIO; + return -ENOMEM; err = ext4_journal_get_write_access(handle, bh); if (err) @@ -470,7 +470,7 @@ static int setup_new_flex_group_blocks(struct super_block *sb, gdb = sb_getblk(sb, block); if (!gdb) { - err = -EIO; + err = -ENOMEM; goto out; } @@ -991,7 +991,7 @@ static void update_backups(struct super_block *sb, bh = sb_getblk(sb, group * bpg + blk_off); if (!bh) { - err = -EIO; + err = -ENOMEM; break; } ext4_debug("update metadata backup %#04lx\n", |