summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/inode_overlay.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2019-07-17 11:13:37 -0700
committergVisor bot <gvisor-bot@google.com>2019-07-17 11:14:57 -0700
commitca829158e385c591d4be21c87cc6ab45116a7cce (patch)
tree58e9996dabdbe1b51a1d01d79f40739d253d1d0f /pkg/sentry/fs/inode_overlay.go
parent78a2704bde50515accacabe8b5734923d0085ef9 (diff)
Properly invalidate cache in rename and remove
We were invalidating the wrong overlayEntry in rename and missing invalidation in rename and remove if lower exists. PiperOrigin-RevId: 258604685
Diffstat (limited to 'pkg/sentry/fs/inode_overlay.go')
-rw-r--r--pkg/sentry/fs/inode_overlay.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/pkg/sentry/fs/inode_overlay.go b/pkg/sentry/fs/inode_overlay.go
index 24b769cfc..e0602da17 100644
--- a/pkg/sentry/fs/inode_overlay.go
+++ b/pkg/sentry/fs/inode_overlay.go
@@ -339,7 +339,9 @@ func overlayRemove(ctx context.Context, o *overlayEntry, parent *Dirent, child *
}
}
if child.Inode.overlay.lowerExists {
- return overlayCreateWhiteout(o.upper, child.name)
+ if err := overlayCreateWhiteout(o.upper, child.name); err != nil {
+ return err
+ }
}
// We've removed from the directory so we must drop the cache.
o.markDirectoryDirty()
@@ -418,10 +420,12 @@ func overlayRename(ctx context.Context, o *overlayEntry, oldParent *Dirent, rena
return err
}
if renamed.Inode.overlay.lowerExists {
- return overlayCreateWhiteout(oldParent.Inode.overlay.upper, oldName)
+ if err := overlayCreateWhiteout(oldParent.Inode.overlay.upper, oldName); err != nil {
+ return err
+ }
}
// We've changed the directory so we must drop the cache.
- o.markDirectoryDirty()
+ oldParent.Inode.overlay.markDirectoryDirty()
return nil
}