gvisor
gvisor copied to clipboard
Passthru more open flags to gofers
Flags like O_NOATIME and O_DIRECT need to be passed to the gofer, otherwise they will have no effect to the underlying file (for the filesystems that support them). Apart from file mode, the only flag passed currently is O_TRUNC.
It will likely require a version bump in the gofer.
Dropping from milestone since this is general FS improvement, not specific to VFS2.
@fvoznika We should also be passing O_SYNC
to the gofer right?
O_SYNC
needs to be handled by goferfs to flush dirty cache pages. It could be added to save the extra syncRemoteFile()
call, but it needs to account for gofers that are not file backed. So not worth until someone actually needs it.
Supporting the passing of O_NOATIME
and O_DIRECT
would require more complex handle sharing in the gofer client.
Currently all reads and writes for an FD go through the backing dentry's read and write handles. I think that has been done to avoid excessive Open
RPCs on the same dentry. We would have to special case FDs that are opened with flags like O_NOATIME
and O_DIRECT
and have special handles for such FDs that were initially opened on remote FS with the right flags.
Note that another level of complexity is that O_DIRECT
and O_NOATIME
flags can change on an FD via fcntl(F_SETFL)
. See vfs.SetStatusFlags(). Those flags are only changed on the VFS level. We would have to implement a filesystem hook for file description status flag updates and re-open the handle appropriately if the flags in question have changed.
Yes it would require keeping extra files for the different options. When a file is being open, it would need to check open flags against other open files to try to find one that is compatible. If none are found, creates a new one an add to the list of open files to be matched.
fcntl(2)
complicate things a bit :-( It could just ignore them, like we do today. Or reopen the backing file with the new options. This is transparent to the application.
Any update on this issue? I'm looking to benchmark gVisor to other runtimes, but I keep running into O_DIRECT flag issue. Other studies seem to be able to pypass this issue, but I cannot figure how they did it.