Repository navigation
core: the direct_io test's reference read goes through the page cache - #486
Merged
Merged
Conversation
The test opened its buffered reference with File.open, which makes the fd O_DIRECT wherever the file system allows it; setting .direct = false did not change the fd. On ext4 on NVMe (a DGX Spark's root disk) the reference pread of 1 byte into an unaligned buffer then fails with EINVAL and the test reports -1. Where O_DIRECT is refused (overlay, tmpfs) File.open falls back and the test passed. The reference fd is now opened without O_DIRECT; the direct handle is unchanged, so the test still checks the O_DIRECT path.
5 of 8 tasks
Owner
|
Thank you, @jschmied, for isolating the direct-I/O test's reference descriptor. Opening that reference without O_DIRECT fixes the comparison and leaves production reads unchanged. On a DGX Spark's ext4 NVMe root, the old test failed and yours passes all three direct-I/O tests; it landed on main with your original commit. |
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.
What this changes
direct_io's test "direct reads return the same bytes as buffered reads" opened its buffered reference withFile.open, which makes the descriptor O_DIRECT wherever the file system allows it; setting.direct = falseafterwards does not change the descriptor. On ext4 on NVMe (a DGX Spark's root disk) the referencepreadof 1 byte into an unaligned buffer then fails with EINVAL, and the test reportsexpected 1, found -1. Where O_DIRECT is refused (overlay, tmpfs)File.openfalls back to the page cache and the test passes, which is why it can go unnoticed.The reference descriptor is now opened without O_DIRECT. The direct handle is unchanged, so the test still checks the O_DIRECT path. Test only, 3 lines.
Receipt
mainat 041d14a, head 9fc4b99. Zig 0.17.0, DGX Spark (GB10), the repository on the root ext4 file system.zig build testfails indirect_iowithexpected 1, found -1, onmainas on every branch.zig build test: 17 of 17 steps, every test passes.