From 8ab0848c70fcebe377a0e7abdebf371022c96830 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Tue, 18 Jun 2019 01:42:28 -0700 Subject: gvisor/fs: don't update file.offset for sockets, pipes, etc sockets, pipes and other non-seekable file descriptors don't use file.offset, so we don't need to update it. With this change, we will be able to call file operations without locking the file.mu mutex. This is already used for pipes in the splice system call. PiperOrigin-RevId: 253746644 --- pkg/sentry/kernel/pipe/pipe.go | 1 + 1 file changed, 1 insertion(+) (limited to 'pkg/sentry/kernel/pipe') diff --git a/pkg/sentry/kernel/pipe/pipe.go b/pkg/sentry/kernel/pipe/pipe.go index 755326d59..8e49070a9 100644 --- a/pkg/sentry/kernel/pipe/pipe.go +++ b/pkg/sentry/kernel/pipe/pipe.go @@ -162,6 +162,7 @@ func NewConnectedPipe(ctx context.Context, sizeBytes, atomicIOBytes int64) (*fs. // // Precondition: at least one of flags.Read or flags.Write must be set. func (p *Pipe) Open(ctx context.Context, d *fs.Dirent, flags fs.FileFlags) *fs.File { + flags.NonSeekable = true switch { case flags.Read && flags.Write: p.rOpen() -- cgit v1.2.3