mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Allow O_DIRECT with gofer.specialFileFD that represent regular files.
gofer.specialFileFD can sometimes represent regular files. O_DIRECT is expected to be supported there. PiperOrigin-RevId: 476408649
This commit is contained in:
@@ -1255,7 +1255,7 @@ func (d *dentry) openSocketByConnecting(ctx context.Context, opts *vfs.OpenOptio
|
||||
|
||||
func (d *dentry) openSpecialFile(ctx context.Context, mnt *vfs.Mount, opts *vfs.OpenOptions) (*vfs.FileDescription, error) {
|
||||
ats := vfs.AccessTypesForOpenFlags(opts)
|
||||
if opts.Flags&linux.O_DIRECT != 0 {
|
||||
if opts.Flags&linux.O_DIRECT != 0 && !d.isRegularFile() {
|
||||
return nil, linuxerr.EINVAL
|
||||
}
|
||||
// We assume that the server silently inserts O_NONBLOCK in the open flags
|
||||
|
||||
@@ -108,8 +108,9 @@ func newSpecialFileFD(h handle, mnt *vfs.Mount, d *dentry, flags uint32) (*speci
|
||||
}
|
||||
}
|
||||
if err := fd.vfsfd.Init(fd, flags, mnt, &d.vfsd, &vfs.FileDescriptionOptions{
|
||||
DenyPRead: !seekable,
|
||||
DenyPWrite: !seekable,
|
||||
AllowDirectIO: true,
|
||||
DenyPRead: !seekable,
|
||||
DenyPWrite: !seekable,
|
||||
}); err != nil {
|
||||
if haveQueue {
|
||||
fdnotifier.RemoveFD(h.fd)
|
||||
|
||||
Reference in New Issue
Block a user