Browse code

Allow re-mounting an existing mount with "remount"

Without this line of code, if a volume is present in /proc/mounts,
it cannot be remounted with new mount options.

Docker-DCO-1.1-Signed-off-by: Peter Waller <p@pwaller.net> (github: pwaller)

Peter Waller authored on 2014/06/25 17:15:08
Showing 1 changed files
... ...
@@ -29,8 +29,11 @@ func Mounted(mountpoint string) (bool, error) {
29 29
 // the target is not mounted
30 30
 // Options must be specified as fstab style
31 31
 func Mount(device, target, mType, options string) error {
32
-	if mounted, err := Mounted(target); err != nil || mounted {
33
-		return err
32
+	flag, _ := parseOptions(options)
33
+	if flag&REMOUNT != REMOUNT {
34
+		if mounted, err := Mounted(target); err != nil || mounted {
35
+			return err
36
+		}
34 37
 	}
35 38
 	return ForceMount(device, target, mType, options)
36 39
 }