mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-01 17:52:40 +00:00
Merge pull request #980 from devimc/topic/left_mount_points
virtcontainers: set private propagation in rootfs
This commit is contained in:
commit
0c09d2bf9a
@ -248,10 +248,16 @@ func bindMount(ctx context.Context, source, destination string, readonly bool) e
|
||||
|
||||
if err := ensureDestinationExists(absSource, destination); err != nil {
|
||||
return fmt.Errorf("Could not create destination mount point %v: %v", destination, err)
|
||||
} else if err := syscall.Mount(absSource, destination, "bind", syscall.MS_BIND, ""); err != nil {
|
||||
}
|
||||
|
||||
if err := syscall.Mount(absSource, destination, "bind", syscall.MS_BIND, ""); err != nil {
|
||||
return fmt.Errorf("Could not bind mount %v to %v: %v", absSource, destination, err)
|
||||
}
|
||||
|
||||
if err := syscall.Mount("none", destination, "", syscall.MS_PRIVATE, ""); err != nil {
|
||||
return fmt.Errorf("Could not make mount point %v private: %v", destination, err)
|
||||
}
|
||||
|
||||
// For readonly bind mounts, we need to remount with the readonly flag.
|
||||
// This is needed as only very recent versions of libmount/util-linux support "bind,ro"
|
||||
if readonly {
|
||||
|
Loading…
Reference in New Issue
Block a user