From 3b11769c772ab667f6f7a1863f6a614a095445ad Mon Sep 17 00:00:00 2001 From: Nicolas Lacasse Date: Tue, 28 Aug 2018 15:17:32 -0700 Subject: fs: Don't bother saving negative dirents. PiperOrigin-RevId: 210616454 Change-Id: I3f536e2b4d603e540cdd9a67c61b8ec3351f4ac3 --- pkg/sentry/fs/dirent_state.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pkg/sentry') 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 -- cgit v1.2.3