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

Commit 164ac36

Browse files
authored
Merge pull request #818 from Random-Liu/cherrypick-#816
Fix double /dev/shm mount.
2 parents fb722f5 + 25b2e87 commit 164ac36

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pkg/server/container_create.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,10 @@ func defaultRuntimeSpec(id string) (*runtimespec.Spec, error) {
777777
if mount.Destination == "/run" {
778778
continue
779779
}
780+
// CRI plugin handles `/dev/shm` itself.
781+
if mount.Destination == "/dev/shm" {
782+
continue
783+
}
780784
mounts = append(mounts, mount)
781785
}
782786
spec.Mounts = mounts

pkg/server/sandbox_run.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,14 @@ func (c *criService) generateSandboxContainerSpec(id string, config *runtime.Pod
388388
g.RemoveLinuxNamespace(string(runtimespec.IPCNamespace)) // nolint: errcheck
389389
}
390390

391+
// It's fine to generate the spec before the sandbox /dev/shm
392+
// is actually created.
393+
sandboxDevShm := c.getSandboxDevShm(id)
394+
if nsOptions.GetIpc() == runtime.NamespaceMode_NODE {
395+
sandboxDevShm = devShm
396+
}
397+
g.AddBindMount(sandboxDevShm, devShm, []string{"rbind", "ro"})
398+
391399
selinuxOpt := securityContext.GetSelinuxOptions()
392400
processLabel, mountLabel, err := initSelinuxOpts(selinuxOpt)
393401
if err != nil {

0 commit comments

Comments
 (0)