Ensure the mount point is propagated

mount with `rshared`, the host path should be shared.
mount with `rslave`, the host pash should be shared or slave.

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
This commit is contained in:
Yanqiang Miao
2017-09-08 22:58:39 +08:00
parent da31647ef8
commit 49eb38a5d4
5 changed files with 212 additions and 36 deletions

View File

@@ -40,6 +40,7 @@ type OS interface {
WriteFile(filename string, data []byte, perm os.FileMode) error
Mount(source string, target string, fstype string, flags uintptr, data string) error
Unmount(target string, flags int) error
GetMounts() ([]*mount.Info, error)
}
// RealOS is used to dispatch the real system level operations.
@@ -114,3 +115,8 @@ func (RealOS) Unmount(target string, flags int) error {
}
return unix.Unmount(target, flags)
}
// GetMounts retrieves a list of mounts for the current running process.
func (RealOS) GetMounts() ([]*mount.Info, error) {
return mount.GetMounts()
}