Skip to content

fix(fs): count a new file's open before its name appears - #171

Merged
mattmattox merged 4 commits into
mainfrom
fix/create-counts-open
Nov 16, 2026
Merged

mattmattox merged 4 commits into
mainfrom
fix/create-counts-open

Conversation

@mattmattox

Copy link
Copy Markdown
Contributor

Closes the race #161's CHANGELOG named. createFileOnce counted the caller's open only after adding the name and touching the parent, and touchParent can block for hundreds of milliseconds when a directory is busy. A peer that unlinked the name in that window left an orphan this node didn't count as open, so this node's own orphan pass freed it before Create returned. The caller's first write then reached a freed slot, which #169 turns into ESTALE. A debug trace confirmed the creator freed it in all 5 cases.

History checker, 3 nodes for 3 minutes:

Calls write ESTALE ENOSPC Other violations
#169, 256 MB image 186,479 ~11 9 27 torn reads
+ this PR, 1 GB image 175,637 0 0 17 torn reads

The torn reads are page-cache tears during a write on the same node. The next PR teaches the checker to accept them.

Also: the checker image goes to 1 GB. At 256 MB it had 257 blocks and filled under churn, with fsck clean. And the EIO sweep test now keeps its injected EIO out of fsck repair, a -race flake.

🤖 Generated with Claude Code

mattmattox and others added 4 commits November 16, 2026 15:38
createFileOnce counted the caller's open only after adding the name and
touching the parent. A peer that unlinked the name in that window left
an orphan this node did not yet count as open, so its next orphan pass
freed the file, and the caller's first write went to a freed or reused
inode. The open is now counted right after the slot is claimed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
At 256 MB the volume has 257 one-MB blocks, so writes failed with ENOSPC
under churn while peers had not yet let go of removed files; fsck showed
no leak.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ight after its creation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the race detector's timing left the workload short of the chosen
write, the EIO landed in fsck's repair, which then left orphans and
blocks it should have freed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit 580d18f into main Nov 16, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant