From 237f9c7a5e7078b46303f1262b77372a2f6a7f7b Mon Sep 17 00:00:00 2001 From: Fabricio Voznika Date: Fri, 16 Nov 2018 18:07:52 -0800 Subject: [PATCH] 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 --- runsc/boot/fs.go | 5 +++-- 1 file 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) } }