mirror of
https://github.com/RhapsodiOS/RhapsodiOS.git
synced 2026-11-03 22:01:40 -07:00
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#67
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/74
#67 (fix
0a354086c) showed thatufs_inactivefrees an inode in the bitmap before the vnode is recycled, soffs_valloccould reallocate the inode and get back the old fifo's or device's vnode, keeping fifo/spec ops on a new regular file.ext2fs_valloc(bsd/ext2fs/ext2fs_alloc.c~158, viaext2fs_vget_alloc) andext2fs_inactivehave the same shape and were not checked. Determine whether the same reuse can happen there (fifo or device node deleted, new file created in the same directory), reproduce it if so, and apply the equivalent fix.Found by the #67 investigation.
@raynorpat commented on GitHub (Oct 20, 2026):
Real on ext2 too. Fixed by
9b61bbd22, merged into ffs-perf in10295357f.Root cause (same shape as #67):
ext2fs_inactive(ext2fs_inode.c:118) frees the inode withVOP_VFREE, then callsVOP_UPDATE(:124), which can sleep, before it unlocks and recycles the vnode (:128-134).ext2fs_valloccan reallocate the inode.ext2fs_vget_alloc(ext2fs_vfsops.c:1594-1601) finds the old vnode in the hash, andvgettakes a use count, sovrecycleleaves the vnode alone.v_un. The new regular file's write then goesvn_write→mapfs_io→vmp_geton the stale fifo data and spins.Reproducer:
vm/work/issue-74/reuse.con a fresh WSL-mke2fs volume. Each process loops: mkfifo, open nonblocking, unlink, close (closing after the unlink is what opens the race), then create a regular file, write and read back 4 KB, unlink.vmp_getwhose new regular file's vnode hadv_op == ext2fs_fifoop_p.Fix: the same as the ffs one. If the vnode
ext2fs_vget_allocreturns doesn't haveext2fs_vnodeop_p,vputit and look the inode up again. Its dtime is already set, soext2fs_inactiverecycles it.Verified on the fixed kernel (cksum 385197266):
reuse.cat 8 and 16 processes for 1200 s each passed: 33,835 and 18,307 iterations, WSLe2fsck -fnclean.ffsbench stress --fs ext2passed fs 12/12 and mmap 18/18, fsck clean.