Repository navigation
feat(fs): fsync directories - #155
Merged
Merged
Conversation
Directories had no Fsync, so go-fuse answered an fsync of a directory with ENOTSUP. Git, SQLite and Postgres fsync a directory after creating or removing an entry in it, and fail or warn. Directory fsync now flushes the device, as file fsync does: without a journal, or with an async one, nothing else makes those entries durable. The device gains a write and a sync observer, so tests can model a write cache that loses everything since the last flush. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h a power cut Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An fsync of a directory returned ENOTSUP, because
Dirand the root didn't implementFsync. Git, SQLite and Postgres fsync a directory after creating or removing an entry in it, then fail or warn. A directory fsync now flushes the device, as a file fsync already does.Why one flush rather than per-mode logic: in Sync and Batch mode, a create or unlink is already durable when it returns, because Commit and CompleteIntent flush before returning. Without a journal, or with an async one, nothing else flushes the entry. A device flush covers every mode and costs one fsync per directory fsync, which applications do rarely.
Rename: this filesystem has no rename, so the tests cover create, mkdir and unlink.
Tests
TestDirectoryFsync(integration, through FUSE's FSYNCDIR) fsyncs directories after create, mkdir and unlink. Docker and VM run the same steps withsync DIR.TestDirFsyncSurvivesPowerCutmodels a disk cache that loses every write since the last flush. The device gains a write observer and a sync observer for this. With no journal, entries made or removed before a directory fsync survive the cut, and a create after the last fsync is lost. The lost create shows the model really drops writes.Results
-short145/0; Docker 55 passed, 1 skipped, 0 failed, including Directory Fsync.TestDirectoryFsyncpasses.TestDirectoryFsyncfails with "operation not supported" at each directory fsync.🤖 Generated with Claude Code