Merge pull request #236 from hqhq/hq_fix_cgroup_rw

Always remount for bind mount
This commit is contained in:
Mrunal Patel 2015-09-14 12:08:34 -07:00
commit 486ac97618
1 changed files with 3 additions and 4 deletions

View File

@ -165,11 +165,10 @@ func mountToRootfs(m *configs.Mount, rootfs, mountLabel string) error {
if err := syscall.Mount(m.Source, dest, m.Device, uintptr(m.Flags), data); err != nil { if err := syscall.Mount(m.Source, dest, m.Device, uintptr(m.Flags), data); err != nil {
return err return err
} }
if m.Flags&syscall.MS_RDONLY != 0 { // bind mount won't change mount options, we need remount to make mount options effective.
if err := syscall.Mount(m.Source, dest, m.Device, uintptr(m.Flags|syscall.MS_REMOUNT), ""); err != nil { if err := syscall.Mount(m.Source, dest, m.Device, uintptr(m.Flags|syscall.MS_REMOUNT), ""); err != nil {
return err return err
} }
}
if m.Relabel != "" { if m.Relabel != "" {
if err := label.Validate(m.Relabel); err != nil { if err := label.Validate(m.Relabel); err != nil {
return err return err