mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Merge pull request #2570 from EduardoVega/2246-fix-chmod-ro-tmpfs-mount
Fix mount error when chmod RO tmpfs
This commit is contained in:
@@ -383,6 +383,12 @@ func mountToRootfs(m *configs.Mount, rootfs, mountLabel string, enableCgroupns b
|
||||
return err
|
||||
}
|
||||
}
|
||||
// Initially mounted rw in mountPropagate, remount to ro if flag set.
|
||||
if m.Flags&unix.MS_RDONLY != 0 {
|
||||
if err := remount(m, rootfs); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
case "bind":
|
||||
if err := prepareBindMount(m, rootfs); err != nil {
|
||||
@@ -981,6 +987,12 @@ func mountPropagate(m *configs.Mount, rootfs string, mountLabel string) error {
|
||||
flags &= ^unix.MS_RDONLY
|
||||
}
|
||||
|
||||
// Mount it rw to allow chmod operation. A remount will be performed
|
||||
// later to make it ro if set.
|
||||
if m.Device == "tmpfs" {
|
||||
flags &= ^unix.MS_RDONLY
|
||||
}
|
||||
|
||||
copyUp := m.Extensions&configs.EXT_COPYUP == configs.EXT_COPYUP
|
||||
if !(copyUp || strings.HasPrefix(dest, rootfs)) {
|
||||
dest = filepath.Join(rootfs, dest)
|
||||
|
||||
Reference in New Issue
Block a user