containerd-shim: Do not remount root MS_SLAVE
Mounting as MS_SLAVE here breaks use cases which want to use rootPropagation=shared in order to expose mounts to the host (and other containers binding the same subtree), mounting as e.g. MS_SHARED is pointless in this context so just remove. Having done this we also need to arrange to manually clean up the mounts on delete, so do so. Note that runc will also setup root as required by rootPropagation, defaulting to MS_PRIVATE. Fixes #1132. Signed-off-by: Ian Campbell <ian.campbell@docker.com>
This commit is contained in:
@@ -22,3 +22,19 @@ func MountAll(mounts []Mount, target string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UnmountN tries to unmount the given mount point nr times, which is
|
||||
// useful for undoing a stack of mounts on the same mount
|
||||
// point. Returns the first error encountered, but always attempts the
|
||||
// full nr umounts.
|
||||
func UnmountN(mount string, flags, nr int) error {
|
||||
var err error
|
||||
for i := 0; i < nr; i++ {
|
||||
if err2 := Unmount(mount, flags); err2 != nil {
|
||||
if err == nil {
|
||||
err = err2
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user