Commit c57ab39b authored by Younger Liu's avatar Younger Liu Committed by Theodore Ts'o

ext4: return ENOMEM rather than EIO when find_###_page() fails

Return ENOMEM rather than EIO when find_get_page() fails in
ext4_mb_get_buddy_page_lock() and find_or_create_page() fails in
ext4_mb_load_buddy().
Signed-off-by: default avatarYounger Liu <younger.liucn@gmail.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 1ce01c4a
...@@ -989,7 +989,7 @@ static int ext4_mb_get_buddy_page_lock(struct super_block *sb, ...@@ -989,7 +989,7 @@ static int ext4_mb_get_buddy_page_lock(struct super_block *sb,
poff = block % blocks_per_page; poff = block % blocks_per_page;
page = find_or_create_page(inode->i_mapping, pnum, GFP_NOFS); page = find_or_create_page(inode->i_mapping, pnum, GFP_NOFS);
if (!page) if (!page)
return -EIO; return -ENOMEM;
BUG_ON(page->mapping != inode->i_mapping); BUG_ON(page->mapping != inode->i_mapping);
e4b->bd_bitmap_page = page; e4b->bd_bitmap_page = page;
e4b->bd_bitmap = page_address(page) + (poff * sb->s_blocksize); e4b->bd_bitmap = page_address(page) + (poff * sb->s_blocksize);
...@@ -1003,7 +1003,7 @@ static int ext4_mb_get_buddy_page_lock(struct super_block *sb, ...@@ -1003,7 +1003,7 @@ static int ext4_mb_get_buddy_page_lock(struct super_block *sb,
pnum = block / blocks_per_page; pnum = block / blocks_per_page;
page = find_or_create_page(inode->i_mapping, pnum, GFP_NOFS); page = find_or_create_page(inode->i_mapping, pnum, GFP_NOFS);
if (!page) if (!page)
return -EIO; return -ENOMEM;
BUG_ON(page->mapping != inode->i_mapping); BUG_ON(page->mapping != inode->i_mapping);
e4b->bd_buddy_page = page; e4b->bd_buddy_page = page;
return 0; return 0;
...@@ -1168,7 +1168,11 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group, ...@@ -1168,7 +1168,11 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group,
unlock_page(page); unlock_page(page);
} }
} }
if (page == NULL || !PageUptodate(page)) { if (page == NULL) {
ret = -ENOMEM;
goto err;
}
if (!PageUptodate(page)) {
ret = -EIO; ret = -EIO;
goto err; goto err;
} }
...@@ -1197,7 +1201,11 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group, ...@@ -1197,7 +1201,11 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group,
unlock_page(page); unlock_page(page);
} }
} }
if (page == NULL || !PageUptodate(page)) { if (page == NULL) {
ret = -ENOMEM;
goto err;
}
if (!PageUptodate(page)) {
ret = -EIO; ret = -EIO;
goto err; goto err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment