Skip to content

Commit 907ea52

Browse files
committed
ext4: convert BUG_ON's to WARN_ON's in mballoc.c
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/[email protected] Google-Bug-Id: 34811296 Google-Bug-Id: 34639169 Signed-off-by: Theodore Ts'o <[email protected]>
1 parent a17a9d9 commit 907ea52

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/ext4/mballoc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,7 +1943,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
19431943
int free;
19441944

19451945
free = e4b->bd_info->bb_free;
1946-
BUG_ON(free <= 0);
1946+
if (WARN_ON(free <= 0))
1947+
return;
19471948

19481949
i = e4b->bd_info->bb_first_free;
19491950

@@ -1966,7 +1967,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
19661967
}
19671968

19681969
mb_find_extent(e4b, i, ac->ac_g_ex.fe_len, &ex);
1969-
BUG_ON(ex.fe_len <= 0);
1970+
if (WARN_ON(ex.fe_len <= 0))
1971+
break;
19701972
if (free < ex.fe_len) {
19711973
ext4_grp_locked_error(sb, e4b->bd_group, 0, 0,
19721974
"%d free clusters as per "

0 commit comments

Comments
 (0)