summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--runsc/container/fs.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/runsc/container/fs.go b/runsc/container/fs.go
index dd8bdf120..b93c866ea 100644
--- a/runsc/container/fs.go
+++ b/runsc/container/fs.go
@@ -117,6 +117,12 @@ func setupFS(spec *specs.Spec, conf *boot.Config, bundleDir string) error {
if err := syscall.Mount(src, dst, m.Type, uintptr(flags), ""); err != nil {
return fmt.Errorf("failed to mount src: %q, dst: %q, flags: %#x, err: %v", src, dst, flags, err)
}
+ // Make the mount a slave, so that for recursive bind mount, umount won't
+ // propagate to the source.
+ flags = syscall.MS_SLAVE | syscall.MS_REC
+ if err := syscall.Mount("", dst, "", uintptr(flags), ""); err != nil {
+ return fmt.Errorf("failed to rslave mount dst: %q, flags: %#x, err: %v", dst, flags, err)
+ }
}
// Remount root as readonly after setup is done, if requested.