summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/gofer/gofer.go
diff options
context:
space:
mode:
authorJamie Liu <jamieliu@google.com>2020-11-12 16:54:22 -0800
committergVisor bot <gvisor-bot@google.com>2020-11-12 16:56:21 -0800
commitae7ab0a330aaa1676d1fe066e3f5ac5fe805ec1c (patch)
tree0d7819a1850ac234c55a0c9a3791eb2544afd6c5 /pkg/sentry/fsimpl/gofer/gofer.go
parent2a1974b07613420cb95845052815afb51187fc85 (diff)
Filter dentries with non-zero refs in VFS2 gofer/overlay checks.
PiperOrigin-RevId: 342161204
Diffstat (limited to 'pkg/sentry/fsimpl/gofer/gofer.go')
-rw-r--r--pkg/sentry/fsimpl/gofer/gofer.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/sentry/fsimpl/gofer/gofer.go b/pkg/sentry/fsimpl/gofer/gofer.go
index 53bcc9986..75a836899 100644
--- a/pkg/sentry/fsimpl/gofer/gofer.go
+++ b/pkg/sentry/fsimpl/gofer/gofer.go
@@ -1352,6 +1352,11 @@ func (d *dentry) checkCachingLocked(ctx context.Context) {
}
if refs > 0 {
if d.cached {
+ // This isn't strictly necessary (fs.cachedDentries is permitted to
+ // contain dentries with non-zero refs, which are skipped by
+ // fs.evictCachedDentryLocked() upon reaching the end of the LRU),
+ // but since we are already holding fs.renameMu for writing we may
+ // as well.
d.fs.cachedDentries.Remove(d)
d.fs.cachedDentriesLen--
d.cached = false