From 48a09f34bd4508bcf245313f37a7e9cc9f6830e2 Mon Sep 17 00:00:00 2001 From: Peter Waller Date: Wed, 25 Jun 2014 09:15:08 +0100 Subject: [PATCH] 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 (github: pwaller) --- mount/mount.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mount/mount.go b/mount/mount.go index 3860b97..5ca7316 100644 --- a/mount/mount.go +++ b/mount/mount.go @@ -29,8 +29,11 @@ func Mounted(mountpoint string) (bool, error) { // the target is not mounted // Options must be specified as fstab style func Mount(device, target, mType, options string) error { - if mounted, err := Mounted(target); err != nil || mounted { - return err + flag, _ := parseOptions(options) + if flag&REMOUNT != REMOUNT { + if mounted, err := Mounted(target); err != nil || mounted { + return err + } } return ForceMount(device, target, mType, options) }