From 0b7cd1e751f70cf6b335754d2b173d9c12b674c7 Mon Sep 17 00:00:00 2001 From: Jamie Liu Date: Fri, 7 Aug 2020 16:33:37 -0700 Subject: Mark dropped pages unevictable in fsimpl/gofer.dentry.destroyLocked. PiperOrigin-RevId: 325531657 --- pkg/sentry/fsimpl/gofer/gofer.go | 7 +++++-- 1 file 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() { -- cgit v1.2.3