summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/fsimpl')
-rw-r--r--pkg/sentry/fsimpl/gofer/gofer.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/sentry/fsimpl/gofer/gofer.go b/pkg/sentry/fsimpl/gofer/gofer.go
index f1d3bf911..4ac8dd81d 100644
--- a/pkg/sentry/fsimpl/gofer/gofer.go
+++ b/pkg/sentry/fsimpl/gofer/gofer.go
@@ -1264,8 +1264,11 @@ func (d *dentry) destroyLocked(ctx context.Context) {
}
}
// Discard cached data.
- d.cache.DropAll(mf)
- d.dirty.RemoveAll()
+ if !d.cache.IsEmpty() {
+ mf.MarkAllUnevictable(d)
+ d.cache.DropAll(mf)
+ d.dirty.RemoveAll()
+ }
d.dataMu.Unlock()
// Clunk open fids and close open host FDs.
if !d.readFile.isNil() {