diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-10-26 23:18:06 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-10-26 23:18:06 +0000 |
commit | 0f69e96daefd4e526de11fba5d04edf5e627e9b4 (patch) | |
tree | f022e7189484dca910cdff37efa4b21300004696 /pkg/sentry/fsimpl/gofer | |
parent | 8ed7429b4634dcfa6cdf39f49299b6292a72631a (diff) | |
parent | 652f11380e44b7c2083fa19d706f5cddf7fe0718 (diff) |
Merge release-20201019.0-63-g652f11380 (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/gofer')
-rw-r--r-- | pkg/sentry/fsimpl/gofer/gofer.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/pkg/sentry/fsimpl/gofer/gofer.go b/pkg/sentry/fsimpl/gofer/gofer.go index 604c6d7cd..80668ebc1 100644 --- a/pkg/sentry/fsimpl/gofer/gofer.go +++ b/pkg/sentry/fsimpl/gofer/gofer.go @@ -153,8 +153,7 @@ type filesystemOptions struct { msize uint32 version string - // maxCachedDentries is the maximum number of dentries with 0 references - // retained by the client. + // maxCachedDentries is the maximum size of filesystem.cachedDentries. maxCachedDentries uint64 // If forcePageCache is true, host FDs may not be used for application @@ -1312,6 +1311,10 @@ func (d *dentry) checkCachingLocked(ctx context.Context) { // resolution, which requires renameMu, so if d.refs is zero then it will // remain zero while we hold renameMu for writing.) refs := atomic.LoadInt64(&d.refs) + if refs == -1 { + // Dentry has already been destroyed. + return + } if refs > 0 { if d.cached { d.fs.cachedDentries.Remove(d) @@ -1320,10 +1323,6 @@ func (d *dentry) checkCachingLocked(ctx context.Context) { } return } - if refs == -1 { - // Dentry has already been destroyed. - return - } // Deleted and invalidated dentries with zero references are no longer // reachable by path resolution and should be dropped immediately. if d.vfsd.IsDead() { |