From abba4e22f668de33a952addf51af143e0787b30e Mon Sep 17 00:00:00 2001 From: Abhinandan Prativadi Date: Tue, 12 Sep 2017 18:09:24 -0700 Subject: [PATCH] Setting rootfspropagation if the mount type shared or slave This is needed by runc to mount volume for containers that expect biderectional file updates or host to container updates. Signed-off-by: Abhinandan Prativadi --- pkg/server/container_create.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/server/container_create.go b/pkg/server/container_create.go index 2c4914ebd..3f5fdd860 100644 --- a/pkg/server/container_create.go +++ b/pkg/server/container_create.go @@ -505,10 +505,17 @@ func addOCIBindMounts(g *generate.Generator, mounts []*runtime.Mount, mountLabel switch mount.GetPropagation() { case runtime.MountPropagation_PROPAGATION_PRIVATE: options = append(options, "rprivate") + // Since default root propogation in runc is rprivate ignore + // setting the root propagation case runtime.MountPropagation_PROPAGATION_BIDIRECTIONAL: options = append(options, "rshared") + g.SetLinuxRootPropagation("rshared") // nolint: errcheck case runtime.MountPropagation_PROPAGATION_HOST_TO_CONTAINER: options = append(options, "rslave") + if g.Spec().Linux.RootfsPropagation != "rshared" && + g.Spec().Linux.RootfsPropagation != "rslave" { + g.SetLinuxRootPropagation("rslave") // nolint: errcheck + } default: glog.Warningf("Unknown propagation mode for hostPath %q", mount.HostPath) options = append(options, "rprivate")