Skip to content

Commit

Permalink
Merge pull request #6729 from thaJeztah/1.5_backport_improve_containe…
Browse files Browse the repository at this point in the history
…r_mount

[release/1.5 backport] Make the temp mount as ready only in container WithVolumes
  • Loading branch information
fuweid committed Mar 24, 2022
2 parents f277cda + 05b04a1 commit 83a2c03
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/cri/opts/container.go
Expand Up @@ -66,6 +66,12 @@ func WithVolumes(volumeMounts map[string]string) containerd.NewContainerOpts {
if err != nil {
return err
}
// Since only read is needed, append ReadOnly mount option to prevent linux kernel
// from syncing whole filesystem in umount syscall.
if len(mounts) == 1 && mounts[0].Type == "overlay" {
mounts[0].Options = append(mounts[0].Options, "ro")
}

root, err := ioutil.TempDir("", "ctd-volume")
if err != nil {
return err
Expand Down

0 comments on commit 83a2c03

Please sign in to comment.