Skip to content

direct_io test: open the comparison fd without O_DIRECT (fixes the host suite on kernel 6.17) - #540

Closed
GustavBlack wants to merge 1 commit into
ashhart:mainfrom
GustavBlack:directio-test-plain-fd
Closed

GustavBlack wants to merge 1 commit into
ashhart:mainfrom
GustavBlack:directio-test-plain-fd

Conversation

@GustavBlack

Copy link
Copy Markdown
Contributor

One-commit, test-only fix for #536 (includes the cause and the C repro there).

On kernel 6.17 hosts, open("/proc/self/exe", O_DIRECT) succeeds (procfs tolerates the flag at
open), so both fds in this test were O_DIRECT; the test cleared only the struct flag, and the
unaligned comparison pread returned -EINVAL — the one failure of zig build test there
(expected 1, found -1).

The change opens the comparison fd explicitly plain, so the test no longer depends on a kernel's
procfs O_DIRECT behavior. The engine is unaffected (checkpoints are real NVMe files; the fallback
covers filesystems that refuse O_DIRECT at open).

Validated on a GB10 (aarch64, Ubuntu 24.04, kernel 6.17.0-1032-nvidia): with this change the full
host suite passes there (previously 75/76). (Developed with AI assistance on our 2×GB10 bring-up
testbed; authorship is mine.)

File.open keeps O_DIRECT where the open succeeds, and since kernel 6.17 procfs
accepts the flag at open, so on such hosts both fds in this test were O_DIRECT
and only the struct flag was cleared: the unaligned comparison pread returned
-EINVAL and the test failed (expected 1, found -1), the one failure of the host
suite there. Open the comparison fd explicitly plain, so the test no longer
depends on a kernel's procfs O_DIRECT behavior.

Fixes ashhart#536
@GustavBlack
GustavBlack force-pushed the directio-test-plain-fd branch from 57ad27c to fcaee43 Compare October 9, 2026 05:22
@plotarmordev

Copy link
Copy Markdown
Contributor

Receipt from a DGX Spark (GB10, kernel 6.17.0-1029-nvidia, Zig 0.17.0, Docker on NGC PyTorch 26.07): zig build test on main (f8fe17d2) fails direct_io: direct reads return the same bytes as buffered reads (75/76, direct_io.zig:100). With this PR (fcaee43f) it passes 76/76. #486 is the same one-line fix, so one of the two can close.

@jschmied

jschmied commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Duplicate of #486 (opened 2026-10-07), which fixes the same direct_io test failure the same way: the comparison descriptor is opened without O_DIRECT. Your note on kernel 6.17 and /proc/self/exe is the clearer explanation of why it fails, and it would fit well on #486. Happy to close either one.

@ashhart

ashhart commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Thank you @GustavBlack. This is the same fix as @jschmied's #486, which landed in 1.0.3 first, so I'm closing this as superseded rather than merging a second copy. Your write-up in #536 helped confirm it, and you're thanked in the 1.0.3 notes.

@ashhart ashhart closed this Oct 10, 2026
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.

4 participants