diff options
author | Michael Pratt <mpratt@google.com> | 2019-05-20 13:34:06 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-05-20 13:35:17 -0700 |
commit | 6588427451c605ee00c8b1a9b6cba06724627ccb (patch) | |
tree | 6aac9eb15f09f5bd485bd8f76787e4876aca6e55 /pkg/sentry/fs/fsutil/inode.go | |
parent | 4a842836e560322bb3944b59ff43b9d60cc0f867 (diff) |
Fix incorrect tmpfs timestamp updates
* Creation of files, directories (and other fs objects) in a directory
should always update ctime.
* Same for removal.
* atime should not be updated on lookup, only readdir.
I've also renamed some misleading functions that update mtime and ctime.
PiperOrigin-RevId: 249115063
Change-Id: I30fa275fa7db96d01aa759ed64628c18bb3a7dc7
Diffstat (limited to 'pkg/sentry/fs/fsutil/inode.go')
-rw-r--r-- | pkg/sentry/fs/fsutil/inode.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/sentry/fs/fsutil/inode.go b/pkg/sentry/fs/fsutil/inode.go index 5e1bfeb58..a22b6ce9c 100644 --- a/pkg/sentry/fs/fsutil/inode.go +++ b/pkg/sentry/fs/fsutil/inode.go @@ -192,6 +192,16 @@ func (i *InodeSimpleAttributes) NotifyStatusChange(ctx context.Context) { i.mu.Unlock() } +// NotifyModificationAndStatusChange updates the modification and status change +// times. +func (i *InodeSimpleAttributes) NotifyModificationAndStatusChange(ctx context.Context) { + i.mu.Lock() + now := ktime.NowFromContext(ctx) + i.unstable.ModificationTime = now + i.unstable.StatusChangeTime = now + i.mu.Unlock() +} + // InodeSimpleExtendedAttributes implements // fs.InodeOperations.{Get,Set,List}xattr. // |