Skip to content

VFS: let fsync synchronize directory file descriptors#930

Closed
brandonpayton wants to merge 1 commit into
mainfrom
fix/directory-fsync
Closed

VFS: let fsync synchronize directory file descriptors#930
brandonpayton wants to merge 1 commit into
mainfrom
fix/directory-fsync

Conversation

@brandonpayton

@brandonpayton brandonpayton commented Jul 13, 2026

Copy link
Copy Markdown
Member

What #907 already landed

#907 landed the broad PHP platform batch, including the mmap and munmap work that was mixed into #769. This PR does not replay that composite history, and it does not describe the old #769 commit as merged verbatim.

Directory fsync() was still unique work. The old source was #769 commit f76741d59, but its unconditional kernel no-op was not kept.

What remains

  • let fsync() accept regular-file and directory descriptors, then delegate both to the active filesystem backend
  • use the native directory durability barrier for Node-backed filesystems
  • keep memory-backed fsync() as a no-op because those writes are already synchronous
  • let OPFS directory fsync() succeed at the documented browser boundary: the File System API has file flush(), but no directory flush primitive
  • cover kernel delegation, Node and memory backends, live Chromium OPFS, and a generic Sortix/POSIX regression
  • document the real durability differences between hosts

What was deliberately removed

  • all mmap, munmap, SQLite patch, harness, and other Fix mmap accounting under partial munmap churn #769 ancestry
  • the old SQLite-specific framing
  • the old design that returned success in the kernel without consulting the backend
  • any claim that OPFS directory fsync() adds a crash-durability barrier

ABI and package impact

This does not change syscall numbers, marshalling, layouts, exports, generated ABI evidence, or ABI_VERSION. The ABI check passes.

No package metadata, package revision, binary index, VFS image, or committed package artifact changes. SQLite, Tcl, and browser images were built only as local validation prerequisites. No output revision needs a bump.

Validation run

All project validation commands ran through scripts/dev-shell.sh.

  • current base verified as 92d5940f7e0107514ea12ab813d395257678377e
  • full kernel suite: 1,152 passed
  • focused host VFS tests: 50 passed
  • full host Vitest: 1,268 passed, 2 expected failures, 130 skipped; teardown lane 3 passed
  • host declaration typecheck passed
  • normal build plus wasm32 and wasm64 musl builds passed
  • ABI snapshot/version check passed
  • libc: 303 passed, 20 documented expected failures, 1 documented flaky test passed
  • focused POSIX fsync: 3 passed
  • focused Sortix directory-fsync: 1 passed
  • browser asset check resolved all 92 imports
  • focused Chromium OPFS regression passed
  • Chromium SQLite sort2.test: 13 cases, 0 errors
  • normal ./run.sh browser preparation completed, the Vite app returned HTTP 200 with COOP/COEP isolation headers, and the prepared non-slow Chromium suite passed 52 tests with 4 intentional skips

Node SQLite sort2.test ran all 13 cases and reported 4 unable to open database file errors in its second pass. That is the existing positioned-I/O cleanup already documented on #786; Chromium passed the same test and this PR does not change positioned I/O.

Validation not run

  • full POSIX and full Sortix suites
  • Firefox and WebKit
  • separate human visual inspection beyond the Playwright browser demo coverage
  • performance benchmarks; this PR makes no performance claim

Delegate fsync on directory descriptors to the active filesystem backend so Node can issue its native durability barrier. Keep memory-backed and OPFS behavior truthful at their host boundaries, and cover the kernel, host backends, Chromium OPFS, and POSIX regression path.
@brandonpayton

Copy link
Copy Markdown
Member Author

Closing this focused source PR because its directory fsync contract across kernel, host, and browser is now carried by #934 at exact green head 260d75d5adc31b327f5591229dbfbb287d395fd6. #934 keeps it as a separate purpose commit and passed the full staging and browser gates. This is not a claim that this branch was merged verbatim.

@brandonpayton brandonpayton deleted the fix/directory-fsync branch July 14, 2026 02:43
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