Commit 49795511 authored by Theodore Ts'o's avatar Theodore Ts'o Committed by Kleber Sacilotto de Souza

ext4: convert BUG_ON's to WARN_ON's in mballoc.c

BugLink: https://bugs.launchpad.net/bugs/1878098

[ Upstream commit 907ea529 ]

If the in-core buddy bitmap gets corrupted (or out of sync with the
block bitmap), issue a WARN_ON and try to recover.  In most cases this
involves skipping trying to allocate out of a particular block group.
We can end up declaring the file system corrupted, which is fair,
since the file system probably should be checked before we proceed any
further.

Link: https://lore.kernel.org/r/20200414035649.293164-1-tytso@mit.edu
Google-Bug-Id: 34811296
Google-Bug-Id: 34639169
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarIan May <ian.may@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 7da7d94d
...@@ -1944,7 +1944,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, ...@@ -1944,7 +1944,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
int free; int free;
free = e4b->bd_info->bb_free; free = e4b->bd_info->bb_free;
BUG_ON(free <= 0); if (WARN_ON(free <= 0))
return;
i = e4b->bd_info->bb_first_free; i = e4b->bd_info->bb_first_free;
...@@ -1965,7 +1966,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, ...@@ -1965,7 +1966,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
} }
mb_find_extent(e4b, i, ac->ac_g_ex.fe_len, &ex); mb_find_extent(e4b, i, ac->ac_g_ex.fe_len, &ex);
BUG_ON(ex.fe_len <= 0); if (WARN_ON(ex.fe_len <= 0))
break;
if (free < ex.fe_len) { if (free < ex.fe_len) {
ext4_grp_locked_error(sb, e4b->bd_group, 0, 0, ext4_grp_locked_error(sb, e4b->bd_group, 0, 0,
"%d free clusters as per " "%d free clusters as per "
......
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