mirror of
https://github.com/RhapsodiOS/RhapsodiOS.git
synced 2026-11-03 22:01:40 -07:00
[GH-ISSUE #70] ext2fs: block/inode allocation panics 'ext2fs_alloccg: map corrupted' when a group fills while bread sleeps #62
Labels
No labels
bug
documentation
enhancement
enhancement
good first issue
help wanted
help wanted
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github-starred/RhapsodiOS#62
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @raynorpat on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/RhapsodiOS/RhapsodiOS/issues/70
Symptom
With several processes writing to an ext2 volume until a block group runs out of space, the kernel panics:
Both panic dumps show the chosen group with
nbfree = 0and a block bitmap that is all0xff. The volume itself is fine: the group really is full.Reproduce
vm/work/ext2-sync/race.sh: 8 concurrent 2 MB writers on a 1K-block ext2 volume (WSLmke2fs -t ext2 -r 1 -O none,filetype,sparse_super -I 128 -b 1024) so that one block group fills up. It panicked within the first loops. The stress suite's concurrent load (ab.sh) hit it in round 3.Cause
ext2fs_alloccg(bsd/ext2fs/ext2fs_alloc.c~378) checks the group'snbfreeand thenbreads the bitmap.breadcan sleep on the bitmap buffer while another allocator, doing its synchronous bitmap write, takes the group's last free blocks. On return the bitmap has no free bit, and the scan reports "map corrupted".ext2fs_nodealloccghas the same pattern for inodes.Fix
d95feb4e2: re-checknbfree/nifreeafter thebreadand return "no space in this group", so the caller tries the next group. Merged into ffs-perf in4fd6d07b6.Verified:
race.sh: 20 of 20 loops clean.mmap/runtests -n 4on ext2, UFS and FAT16: 18/18 PASS each.ext2_mmap_truncate_testandmake check-mmappass.e2fsck -fnis clean after every run.Found while investigating an ext2
mmap syncread-back failure under concurrent load. That failure itself was the QEMU FSAVE problem filed separately.@raynorpat commented on GitHub (Oct 20, 2026):
Fixed by
d95feb4e2, merged into ffs-perf in4fd6d07b6(verification in the issue body).