summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/gofer/gofer.go
diff options
context:
space:
mode:
authorJamie Liu <jamieliu@google.com>2020-08-07 16:33:37 -0700
committergVisor bot <gvisor-bot@google.com>2020-08-07 16:35:20 -0700
commit0b7cd1e751f70cf6b335754d2b173d9c12b674c7 (patch)
tree3e7ed28ad637f2a22a5d2f7504cbce497463e979 /pkg/sentry/fsimpl/gofer/gofer.go
parent80c80a14101aca90ee21aa6f6c934673c50e6cee (diff)
Mark dropped pages unevictable in fsimpl/gofer.dentry.destroyLocked.
PiperOrigin-RevId: 325531657
Diffstat (limited to 'pkg/sentry/fsimpl/gofer/gofer.go')
-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() {