summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/fs')
-rw-r--r--pkg/sentry/fs/tmpfs/file_regular.go2
-rw-r--r--pkg/sentry/fs/tmpfs/inode_file.go12
2 files changed, 8 insertions, 6 deletions
diff --git a/pkg/sentry/fs/tmpfs/file_regular.go b/pkg/sentry/fs/tmpfs/file_regular.go
index 2c1eb0fd2..be6298130 100644
--- a/pkg/sentry/fs/tmpfs/file_regular.go
+++ b/pkg/sentry/fs/tmpfs/file_regular.go
@@ -44,7 +44,7 @@ type regularFileOperations struct {
// Read implements fs.FileOperations.Read.
func (r *regularFileOperations) Read(ctx context.Context, file *fs.File, dst usermem.IOSequence, offset int64) (int64, error) {
- return r.iops.read(ctx, dst, offset)
+ return r.iops.read(ctx, file, dst, offset)
}
// Write implements fs.FileOperations.Write.
diff --git a/pkg/sentry/fs/tmpfs/inode_file.go b/pkg/sentry/fs/tmpfs/inode_file.go
index 1cc972afa..5648ff8f4 100644
--- a/pkg/sentry/fs/tmpfs/inode_file.go
+++ b/pkg/sentry/fs/tmpfs/inode_file.go
@@ -250,7 +250,7 @@ func (*fileInodeOperations) StatFS(context.Context) (fs.Info, error) {
return fsInfo, nil
}
-func (f *fileInodeOperations) read(ctx context.Context, dst usermem.IOSequence, offset int64) (int64, error) {
+func (f *fileInodeOperations) read(ctx context.Context, file *fs.File, dst usermem.IOSequence, offset int64) (int64, error) {
var start time.Time
if fs.RecordWaitTime {
start = time.Now()
@@ -280,10 +280,12 @@ func (f *fileInodeOperations) read(ctx context.Context, dst usermem.IOSequence,
}
n, err := dst.CopyOutFrom(ctx, &fileReadWriter{f, offset})
- // Compare Linux's mm/filemap.c:do_generic_file_read() => file_accessed().
- f.attrMu.Lock()
- f.attr.AccessTime = ktime.NowFromContext(ctx)
- f.attrMu.Unlock()
+ if !file.Dirent.Inode.MountSource.Flags.NoAtime {
+ // Compare Linux's mm/filemap.c:do_generic_file_read() => file_accessed().
+ f.attrMu.Lock()
+ f.attr.AccessTime = ktime.NowFromContext(ctx)
+ f.attrMu.Unlock()
+ }
fs.IncrementWait(readWait, start)
return n, err
}