|
@@ -48,16 +48,23 @@ func MakeRUnbindable(mountPoint string) error {
|
|
|
return ensureMountedAs(mountPoint, "runbindable")
|
|
|
}
|
|
|
|
|
|
-func ensureMountedAs(mountPoint, options string) error {
|
|
|
- mounted, err := Mounted(mountPoint)
|
|
|
+// MakeMount ensures that the file or directory given is a mount point,
|
|
|
+// bind mounting it to itself it case it is not.
|
|
|
+func MakeMount(mnt string) error {
|
|
|
+ mounted, err := Mounted(mnt)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
+ if mounted {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+
|
|
|
+ return Mount(mnt, mnt, "none", "bind")
|
|
|
+}
|
|
|
|
|
|
- if !mounted {
|
|
|
- if err := Mount(mountPoint, mountPoint, "none", "bind"); err != nil {
|
|
|
- return err
|
|
|
- }
|
|
|
+func ensureMountedAs(mountPoint, options string) error {
|
|
|
+ if err := MakeMount(mountPoint); err != nil {
|
|
|
+ return err
|
|
|
}
|
|
|
|
|
|
return ForceMount("", mountPoint, "none", options)
|