Skip to content

Commit c04e88e

Browse files
Wang Shilongjankara
authored andcommitted
Ext3: return ENOMEM rather than EIO if sb_getblk fails
It will be better to use ENOMEM rather than EIO, because the only reason that sb_getblk fails is that allocation fails. Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Jan Kara <jack@suse.cz>
1 parent ab6a773 commit c04e88e

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎fs/ext3/inode.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ struct buffer_head *ext3_getblk(handle_t *handle, struct inode *inode,
10831083
struct buffer_head *bh;
10841084
bh = sb_getblk(inode->i_sb, dummy.b_blocknr);
10851085
if (unlikely(!bh)) {
1086-
*errp = -EIO;
1086+
*errp = -ENOMEM;
10871087
goto err;
10881088
}
10891089
if (buffer_new(&dummy)) {
@@ -2738,7 +2738,7 @@ static int __ext3_get_inode_loc(struct inode *inode,
27382738
"unable to read inode block - "
27392739
"inode=%lu, block="E3FSBLK,
27402740
inode->i_ino, block);
2741-
return -EIO;
2741+
return -ENOMEM;
27422742
}
27432743
if (!buffer_uptodate(bh)) {
27442744
lock_buffer(bh);

‎fs/ext3/resize.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static struct buffer_head *bclean(handle_t *handle, struct super_block *sb,
117117

118118
bh = sb_getblk(sb, blk);
119119
if (unlikely(!bh))
120-
return ERR_PTR(-EIO);
120+
return ERR_PTR(-ENOMEM);
121121
if ((err = ext3_journal_get_write_access(handle, bh))) {
122122
brelse(bh);
123123
bh = ERR_PTR(err);
@@ -235,7 +235,7 @@ static int setup_new_group_blocks(struct super_block *sb,
235235

236236
gdb = sb_getblk(sb, block);
237237
if (unlikely(!gdb)) {
238-
err = -EIO;
238+
err = -ENOMEM;
239239
goto exit_bh;
240240
}
241241
if ((err = ext3_journal_get_write_access(handle, gdb))) {
@@ -723,7 +723,7 @@ static void update_backups(struct super_block *sb,
723723

724724
bh = sb_getblk(sb, group * bpg + blk_off);
725725
if (unlikely(!bh)) {
726-
err = -EIO;
726+
err = -ENOMEM;
727727
break;
728728
}
729729
ext3_debug("update metadata backup %#04lx\n",

‎fs/ext3/xattr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode,
816816
if (unlikely(!new_bh)) {
817817
getblk_failed:
818818
ext3_free_blocks(handle, inode, block, 1);
819-
error = -EIO;
819+
error = -ENOMEM;
820820
goto cleanup;
821821
}
822822
lock_buffer(new_bh);

0 commit comments

Comments
 (0)