diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/sentry/fs/dirent.go | 2 | ||||
-rw-r--r-- | pkg/sentry/fs/gofer/session.go | 2 | ||||
-rw-r--r-- | pkg/sentry/fs/mock.go | 2 | ||||
-rw-r--r-- | pkg/sentry/fs/mount.go | 14 | ||||
-rw-r--r-- | pkg/sentry/fs/mount_overlay.go | 4 | ||||
-rw-r--r-- | pkg/sentry/fs/tty/fs.go | 2 |
6 files changed, 14 insertions, 12 deletions
diff --git a/pkg/sentry/fs/dirent.go b/pkg/sentry/fs/dirent.go index 5eaa2189a..f9bf2fba6 100644 --- a/pkg/sentry/fs/dirent.go +++ b/pkg/sentry/fs/dirent.go @@ -488,7 +488,7 @@ func (d *Dirent) walk(ctx context.Context, root *Dirent, name string, walkMayUnl // // We never allow the file system to revalidate mounts, that could cause them // to unexpectedly drop out before umount. - if cd.mounted || !cd.Inode.MountSource.Revalidate(cd) { + if cd.mounted || !cd.Inode.MountSource.Revalidate(ctx, cd) { // Good to go. This is the fast-path. return cd, nil } diff --git a/pkg/sentry/fs/gofer/session.go b/pkg/sentry/fs/gofer/session.go index 21dc5e08d..b6841526a 100644 --- a/pkg/sentry/fs/gofer/session.go +++ b/pkg/sentry/fs/gofer/session.go @@ -121,7 +121,7 @@ func (s *session) Destroy() { } // Revalidate returns true if the cache policy is does not allow for VFS caching. -func (s *session) Revalidate(*fs.Dirent) bool { +func (s *session) Revalidate(ctx context.Context, d *fs.Dirent) bool { return s.cachePolicy.revalidateDirent() } diff --git a/pkg/sentry/fs/mock.go b/pkg/sentry/fs/mock.go index b3bfa5268..dc82a2002 100644 --- a/pkg/sentry/fs/mock.go +++ b/pkg/sentry/fs/mock.go @@ -68,7 +68,7 @@ func NewMockMountSource(cache *DirentCache) *MountSource { } // Revalidate implements fs.MountSourceOperations.Revalidate. -func (n *MockMountSourceOps) Revalidate(*Dirent) bool { +func (n *MockMountSourceOps) Revalidate(context.Context, *Dirent) bool { return n.revalidate } diff --git a/pkg/sentry/fs/mount.go b/pkg/sentry/fs/mount.go index 1d05a36a7..eb1897174 100644 --- a/pkg/sentry/fs/mount.go +++ b/pkg/sentry/fs/mount.go @@ -21,17 +21,19 @@ import ( "sync/atomic" "gvisor.googlesource.com/gvisor/pkg/refs" + "gvisor.googlesource.com/gvisor/pkg/sentry/context" ) // DirentOperations provide file systems greater control over how long a Dirent stays pinned // in core. Implementations must not take Dirent.mu. type DirentOperations interface { - // Revalidate returns true if the Dirent is stale and its InodeOperations needs to be reloaded. Revalidate - // will never be called on a Dirent that is mounted. - Revalidate(dirent *Dirent) bool + // Revalidate returns true if the Dirent is stale and its + // InodeOperations needs to be reloaded. Revalidate will never be + // called on a Dirent that is mounted. + Revalidate(ctx context.Context, dirent *Dirent) bool - // Keep returns true if the Dirent should be kept in memory for as long as possible - // beyond any active references. + // Keep returns true if the Dirent should be kept in memory for as long + // as possible beyond any active references. Keep(dirent *Dirent) bool } @@ -263,7 +265,7 @@ type SimpleMountSourceOperations struct { } // Revalidate implements MountSourceOperations.Revalidate. -func (*SimpleMountSourceOperations) Revalidate(*Dirent) bool { +func (*SimpleMountSourceOperations) Revalidate(context.Context, *Dirent) bool { return false } diff --git a/pkg/sentry/fs/mount_overlay.go b/pkg/sentry/fs/mount_overlay.go index 343202400..1be81e3a1 100644 --- a/pkg/sentry/fs/mount_overlay.go +++ b/pkg/sentry/fs/mount_overlay.go @@ -34,8 +34,8 @@ func newOverlayMountSource(upper, lower *MountSource, flags MountSourceFlags) *M // Revalidate panics if the upper or lower MountSource require that dirent be // revalidated. Otherwise always returns false. -func (o *overlayMountSourceOperations) Revalidate(dirent *Dirent) bool { - if o.upper.Revalidate(dirent) || o.lower.Revalidate(dirent) { +func (o *overlayMountSourceOperations) Revalidate(ctx context.Context, dirent *Dirent) bool { + if o.upper.Revalidate(ctx, dirent) || o.lower.Revalidate(ctx, dirent) { panic("an overlay cannot revalidate file objects") } return false diff --git a/pkg/sentry/fs/tty/fs.go b/pkg/sentry/fs/tty/fs.go index 1ef1a85e3..dbaffe95e 100644 --- a/pkg/sentry/fs/tty/fs.go +++ b/pkg/sentry/fs/tty/fs.go @@ -78,7 +78,7 @@ type superOperations struct{} // Slave entries are dropped from dir when their master is closed, so an // existing slave Dirent in the tree is not sufficient to guarantee that it // still exists on the filesystem. -func (superOperations) Revalidate(*fs.Dirent) bool { +func (superOperations) Revalidate(context.Context, *fs.Dirent) bool { return true } |