-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Description
Hello, I've migrated from docker/docker/pkg/mount to moby/sys/mount, and I've run in a small issue.
I'm running this test:
package main
import (
"os"
"github.com/moby/sys/mount"
)
func main() {
_ = os.Mkdir("/tmp/test", 0755)
err := mount.Mount("tmpfs", "/tmp/test", "tmpfs", "ro")
if err != nil {
panic(err)
}
err = mount.Mount("", "/tmp/test", "none", "remount,rw")
if err != nil {
panic(err)
}
}And "remount,rw" doesn't get executed. Not sure if this is expected behavior.
It doesn't enter any case in this function:
Lines 30 to 72 in 638aa7c
| func mount(device, target, mType string, flags uintptr, data string) error { | |
| oflags := flags &^ ptypes | |
| if !isremount(device, flags) || data != "" { | |
| // Initial call applying all non-propagation flags for mount | |
| // or remount with changed data | |
| if err := unix.Mount(device, target, mType, oflags, data); err != nil { | |
| return &mountError{ | |
| op: "mount", | |
| source: device, | |
| target: target, | |
| flags: oflags, | |
| data: data, | |
| err: err, | |
| } | |
| } | |
| } | |
| if flags&ptypes != 0 { | |
| // Change the propagation type. | |
| if err := unix.Mount("", target, "", flags&pflags, ""); err != nil { | |
| return &mountError{ | |
| op: "remount", | |
| target: target, | |
| flags: flags & pflags, | |
| err: err, | |
| } | |
| } | |
| } | |
| if oflags&broflags == broflags { | |
| // Remount the bind to apply read only. | |
| if err := unix.Mount("", target, "", oflags|unix.MS_REMOUNT, ""); err != nil { | |
| return &mountError{ | |
| op: "remount-ro", | |
| target: target, | |
| flags: oflags | unix.MS_REMOUNT, | |
| err: err, | |
| } | |
| } | |
| } | |
| return nil | |
| } |
Metadata
Metadata
Assignees
Labels
No labels