summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2018-05-09 16:57:31 -0700
committerShentubot <shentubot@google.com>2018-05-09 16:58:21 -0700
commitc97f0978b7ced0a31891fab639cc6c9a80e7fb37 (patch)
tree9c630c257c14135dd9aaec0f2b32e9f0b3fbfbcf /pkg/sentry
parentb3bfb24991484d8d5a0989058a752cac325fbfb0 (diff)
Cache symlinks in addition to files and directories.
PiperOrigin-RevId: 196051326 Change-Id: I4195b110e9a7d38d1ce1ed9c613971dea1be3bf0
Diffstat (limited to 'pkg/sentry')
-rw-r--r--pkg/sentry/fs/gofer/session.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/sentry/fs/gofer/session.go b/pkg/sentry/fs/gofer/session.go
index ab3b964e0..1076e3e55 100644
--- a/pkg/sentry/fs/gofer/session.go
+++ b/pkg/sentry/fs/gofer/session.go
@@ -126,9 +126,12 @@ func (s *session) Revalidate(*fs.Dirent) bool {
// TakeRefs takes an extra reference on dirent if possible.
func (s *session) Keep(dirent *fs.Dirent) bool {
- // NOTE: Only cache files and directories.
sattr := dirent.Inode.StableAttr
- return s.cachePolicy != cacheNone && (fs.IsFile(sattr) || fs.IsDir(sattr))
+ if s.cachePolicy == cacheNone {
+ return false
+ }
+ // NOTE: Only cache files, directories, and symlinks.
+ return fs.IsFile(sattr) || fs.IsDir(sattr) || fs.IsSymlink(sattr)
}
// ResetInodeMappings implements fs.MountSourceOperations.ResetInodeMappings.