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 <abhi@docker.com>
This commit is contained in:
parent
5b44da76e8
commit
abba4e22f6
@ -505,10 +505,17 @@ func addOCIBindMounts(g *generate.Generator, mounts []*runtime.Mount, mountLabel
|
|||||||
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")
|
||||||
|
Loading…
Reference in New Issue
Block a user