summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2018-08-28 15:17:32 -0700
committerShentubot <shentubot@google.com>2018-08-28 15:18:42 -0700
commit3b11769c772ab667f6f7a1863f6a614a095445ad (patch)
tree595ba40433da33dad0b72794b714bf69459bee37
parent515d9bf43b358cf7645d34dccdcc299f43dd8d74 (diff)
fs: Don't bother saving negative dirents.
PiperOrigin-RevId: 210616454 Change-Id: I3f536e2b4d603e540cdd9a67c61b8ec3351f4ac3
-rw-r--r--pkg/sentry/fs/dirent_state.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/sentry/fs/dirent_state.go b/pkg/sentry/fs/dirent_state.go
index fb81e7d54..58dd01202 100644
--- a/pkg/sentry/fs/dirent_state.go
+++ b/pkg/sentry/fs/dirent_state.go
@@ -45,7 +45,13 @@ func (d *Dirent) saveChildren() map[string]*Dirent {
if rc := w.Get(); rc != nil {
// Drop the reference count obtain in w.Get()
rc.DecRef()
- c[name] = rc.(*Dirent)
+
+ cd := rc.(*Dirent)
+ if cd.IsNegative() {
+ // Don't bother saving negative Dirents.
+ continue
+ }
+ c[name] = cd
}
}
return c