diff options
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r-- | fs/ext4/mballoc.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 4258d3289a6f..500d3920d41d 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -3736,20 +3736,23 @@ ext4_mb_discard_group_preallocations(struct super_block *sb, | |||
3736 | 3736 | ||
3737 | bitmap_bh = ext4_read_block_bitmap(sb, group); | 3737 | bitmap_bh = ext4_read_block_bitmap(sb, group); |
3738 | if (bitmap_bh == NULL) { | 3738 | if (bitmap_bh == NULL) { |
3739 | /* error handling here */ | 3739 | ext4_error(sb, __func__, "Error in reading block " |
3740 | ext4_mb_release_desc(&e4b); | 3740 | "bitmap for %lu\n", group); |
3741 | BUG_ON(bitmap_bh == NULL); | 3741 | return 0; |
3742 | } | 3742 | } |
3743 | 3743 | ||
3744 | err = ext4_mb_load_buddy(sb, group, &e4b); | 3744 | err = ext4_mb_load_buddy(sb, group, &e4b); |
3745 | BUG_ON(err != 0); /* error handling here */ | 3745 | if (err) { |
3746 | ext4_error(sb, __func__, "Error in loading buddy " | ||
3747 | "information for %lu\n", group); | ||
3748 | put_bh(bitmap_bh); | ||
3749 | return 0; | ||
3750 | } | ||
3746 | 3751 | ||
3747 | if (needed == 0) | 3752 | if (needed == 0) |
3748 | needed = EXT4_BLOCKS_PER_GROUP(sb) + 1; | 3753 | needed = EXT4_BLOCKS_PER_GROUP(sb) + 1; |
3749 | 3754 | ||
3750 | grp = ext4_get_group_info(sb, group); | ||
3751 | INIT_LIST_HEAD(&list); | 3755 | INIT_LIST_HEAD(&list); |
3752 | |||
3753 | ac = kmem_cache_alloc(ext4_ac_cachep, GFP_NOFS); | 3756 | ac = kmem_cache_alloc(ext4_ac_cachep, GFP_NOFS); |
3754 | repeat: | 3757 | repeat: |
3755 | ext4_lock_group(sb, group); | 3758 | ext4_lock_group(sb, group); |
@@ -3906,13 +3909,18 @@ repeat: | |||
3906 | ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, NULL); | 3909 | ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, NULL); |
3907 | 3910 | ||
3908 | err = ext4_mb_load_buddy(sb, group, &e4b); | 3911 | err = ext4_mb_load_buddy(sb, group, &e4b); |
3909 | BUG_ON(err != 0); /* error handling here */ | 3912 | if (err) { |
3913 | ext4_error(sb, __func__, "Error in loading buddy " | ||
3914 | "information for %lu\n", group); | ||
3915 | continue; | ||
3916 | } | ||
3910 | 3917 | ||
3911 | bitmap_bh = ext4_read_block_bitmap(sb, group); | 3918 | bitmap_bh = ext4_read_block_bitmap(sb, group); |
3912 | if (bitmap_bh == NULL) { | 3919 | if (bitmap_bh == NULL) { |
3913 | /* error handling here */ | 3920 | ext4_error(sb, __func__, "Error in reading block " |
3921 | "bitmap for %lu\n", group); | ||
3914 | ext4_mb_release_desc(&e4b); | 3922 | ext4_mb_release_desc(&e4b); |
3915 | BUG_ON(bitmap_bh == NULL); | 3923 | continue; |
3916 | } | 3924 | } |
3917 | 3925 | ||
3918 | ext4_lock_group(sb, group); | 3926 | ext4_lock_group(sb, group); |
@@ -4423,11 +4431,15 @@ do_more: | |||
4423 | count -= overflow; | 4431 | count -= overflow; |
4424 | } | 4432 | } |
4425 | bitmap_bh = ext4_read_block_bitmap(sb, block_group); | 4433 | bitmap_bh = ext4_read_block_bitmap(sb, block_group); |
4426 | if (!bitmap_bh) | 4434 | if (!bitmap_bh) { |
4435 | err = -EIO; | ||
4427 | goto error_return; | 4436 | goto error_return; |
4437 | } | ||
4428 | gdp = ext4_get_group_desc(sb, block_group, &gd_bh); | 4438 | gdp = ext4_get_group_desc(sb, block_group, &gd_bh); |
4429 | if (!gdp) | 4439 | if (!gdp) { |
4440 | err = -EIO; | ||
4430 | goto error_return; | 4441 | goto error_return; |
4442 | } | ||
4431 | 4443 | ||
4432 | if (in_range(ext4_block_bitmap(sb, gdp), block, count) || | 4444 | if (in_range(ext4_block_bitmap(sb, gdp), block, count) || |
4433 | in_range(ext4_inode_bitmap(sb, gdp), block, count) || | 4445 | in_range(ext4_inode_bitmap(sb, gdp), block, count) || |