Repository navigation
Conversation
ayushr2
commented
Oct 20, 2026
ayushr2
left a comment
Contributor
Author
There was a problem hiding this comment.
Three correctness issues reproduced in the O_DIRECT handling; details inline.
ayushr2
force-pushed
the
gofer-odirect
branch
4 times, most recently
from
October 21, 2026 07:12
9b04301 to
e3ec99b
Compare
ayushr2
marked this pull request as ready for review
October 21, 2026 07:44
ayushr2
marked this pull request as draft
November 7, 2026 19:57
O_DIRECT on gofer regular files only bypasses the sentry page cache. I/O still goes through the dentry's shared host FDs, which are opened without O_DIRECT, so it is cached by the host. A regularFileFD opened with O_DIRECT now also opens a per-FD handle with O_DIRECT. While O_DIRECT is set, reads and writes whose offset, length and memory are all page-aligned use it. Other I/O may not meet O_DIRECT alignment requirements, e.g. splice(2) through sentry buffers and its continuations after short transfers, so it keeps using the shared handles, as do mmap and fsync; the host keeps both coherent. Clearing O_DIRECT with fcntl(F_SETFL) switches all I/O back to the shared handles; setting it later keeps the old behavior. The per-FD handle is only used if the gofer donates a host FD, since lisafs I/O buffers are not aligned. Updates gvisor#3626 Signed-off-by: Ayush Ranjan <[email protected]>
ayushr2
force-pushed
the
gofer-odirect
branch
from
November 18, 2026 16:49
e3ec99b to
1d74201
Compare
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.
O_DIRECT on gofer regular files only bypasses the sentry page cache. I/O
still goes through the dentry's shared host FDs, which are opened without
O_DIRECT, so it is cached by the host.
A regularFileFD opened with O_DIRECT now also opens a per-FD handle with
O_DIRECT. While O_DIRECT is set, reads and writes whose offset, length and
memory are all page-aligned use it. Other I/O may not meet O_DIRECT
alignment requirements, e.g. splice(2) through sentry buffers and its
continuations after short transfers, so it keeps using the shared handles,
as do mmap and fsync; the host keeps both coherent. Clearing O_DIRECT with
fcntl(F_SETFL) switches all I/O back to the shared handles; setting it
later keeps the old behavior. The per-FD handle is only used if the gofer
donates a host FD, since lisafs I/O buffers are not aligned.
Updates #3626