mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
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
This commit is contained in:
committed by
Nicolas Lacasse
parent
845836c578
commit
237f9c7a5e
+3
-2
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user