Cache symlinks in addition to files and directories.

PiperOrigin-RevId: 196051326
Change-Id: I4195b110e9a7d38d1ce1ed9c613971dea1be3bf0
This commit is contained in:
Nicolas Lacasse 2018-05-09 16:57:31 -07:00 committed by Shentubot
parent b3bfb24991
commit c97f0978b7
1 changed files with 5 additions and 2 deletions

View File

@ -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.