Merge pull request #252 from abhinandanpb/rshared

Setting rootfs mount propagation if the mount type is rshared/shared
This commit is contained in:
Lantao Liu 2017-09-17 12:23:39 -07:00 committed by GitHub
commit 8a03d551da

View File

@ -555,10 +555,17 @@ func (c *criContainerdService) addOCIBindMounts(g *generate.Generator, mounts []
switch mount.GetPropagation() { switch mount.GetPropagation() {
case runtime.MountPropagation_PROPAGATION_PRIVATE: case runtime.MountPropagation_PROPAGATION_PRIVATE:
options = append(options, "rprivate") options = append(options, "rprivate")
// Since default root propogation in runc is rprivate ignore
// setting the root propagation
case runtime.MountPropagation_PROPAGATION_BIDIRECTIONAL: case runtime.MountPropagation_PROPAGATION_BIDIRECTIONAL:
options = append(options, "rshared") options = append(options, "rshared")
g.SetLinuxRootPropagation("rshared") // nolint: errcheck
case runtime.MountPropagation_PROPAGATION_HOST_TO_CONTAINER: case runtime.MountPropagation_PROPAGATION_HOST_TO_CONTAINER:
options = append(options, "rslave") options = append(options, "rslave")
if g.Spec().Linux.RootfsPropagation != "rshared" &&
g.Spec().Linux.RootfsPropagation != "rslave" {
g.SetLinuxRootPropagation("rslave") // nolint: errcheck
}
default: default:
glog.Warningf("Unknown propagation mode for hostPath %q", mount.HostPath) glog.Warningf("Unknown propagation mode for hostPath %q", mount.HostPath)
options = append(options, "rprivate") options = append(options, "rprivate")