Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #818 from Random-Liu/cherrypick-#816
Browse files Browse the repository at this point in the history
Fix double /dev/shm mount.
  • Loading branch information
Random-Liu authored Jun 15, 2018
2 parents fb722f5 + 25b2e87 commit 164ac36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/server/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,10 @@ func defaultRuntimeSpec(id string) (*runtimespec.Spec, error) {
if mount.Destination == "/run" {
continue
}
// CRI plugin handles `/dev/shm` itself.
if mount.Destination == "/dev/shm" {
continue
}
mounts = append(mounts, mount)
}
spec.Mounts = mounts
Expand Down
8 changes: 8 additions & 0 deletions pkg/server/sandbox_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,14 @@ func (c *criService) generateSandboxContainerSpec(id string, config *runtime.Pod
g.RemoveLinuxNamespace(string(runtimespec.IPCNamespace)) // nolint: errcheck
}

// It's fine to generate the spec before the sandbox /dev/shm
// is actually created.
sandboxDevShm := c.getSandboxDevShm(id)
if nsOptions.GetIpc() == runtime.NamespaceMode_NODE {
sandboxDevShm = devShm
}
g.AddBindMount(sandboxDevShm, devShm, []string{"rbind", "ro"})

selinuxOpt := securityContext.GetSelinuxOptions()
processLabel, mountLabel, err := initSelinuxOpts(selinuxOpt)
if err != nil {
Expand Down

0 comments on commit 164ac36

Please sign in to comment.