summaryrefslogtreecommitdiffhomepage
path: root/runsc/boot/fs.go
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2018-11-16 18:07:52 -0800
committerNicolas Lacasse <nlacasse@google.com>2018-11-20 14:03:42 -0800
commit237f9c7a5e7078b46303f1262b77372a2f6a7f7b (patch)
tree48bd91fdc88ec43ee55a01d56ee0e3444751a369 /runsc/boot/fs.go
parent845836c5783cb237c28b91f2f9a8f52a8219228e (diff)
Don't fail when destroyContainerFS is called more than once
This can happen when destroy is called multiple times or when destroy failed previously and is being called again. PiperOrigin-RevId: 221882034 Change-Id: I8d069af19cf66c4e2419bdf0d4b789c5def8d19e
Diffstat (limited to 'runsc/boot/fs.go')
-rw-r--r--runsc/boot/fs.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/runsc/boot/fs.go b/runsc/boot/fs.go
index 3f3f9bef6..1e355fe4e 100644
--- a/runsc/boot/fs.go
+++ b/runsc/boot/fs.go
@@ -673,10 +673,11 @@ func destroyContainerFS(ctx context.Context, cid string, k *kernel.Kernel) error
defer root.DecRef()
// Do a best-effort unmount by flushing the refs and unmount
- // with "detach only = true".
+ // with "detach only = true". Unmount returns EINVAL when the mount point
+ // doesn't exist, i.e. it has already been unmounted.
log.Debugf("Unmounting container submount %q", root.BaseName())
m.FlushDirentRefs()
- if err := mns.Unmount(ctx, root, true /* detach only */); err != nil {
+ if err := mns.Unmount(ctx, root, true /* detach only */); err != nil && err != syserror.EINVAL {
return fmt.Errorf("error unmounting container submount %q: %v", root.BaseName(), err)
}
}