Browse code

pkg/mount: simplify ensureMountedAs

1. There is no need to specify rw argument -- bind mounts are
read-write by default.

2. There is no point in parsing /proc/self/mountinfo after performing
a mount, especially if we don't check whether the fs is mounted or
not -- the only outcome from it could be an error from our mountinfo
parser, which makes no sense in this context.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>

Kir Kolyshkin authored on 2018/10/12 15:16:10
Showing 1 changed files
... ...
@@ -55,13 +55,10 @@ func ensureMountedAs(mountPoint, options string) error {
55 55
 	}
56 56
 
57 57
 	if !mounted {
58
-		if err := Mount(mountPoint, mountPoint, "none", "bind,rw"); err != nil {
58
+		if err := Mount(mountPoint, mountPoint, "none", "bind"); err != nil {
59 59
 			return err
60 60
 		}
61 61
 	}
62
-	if _, err = Mounted(mountPoint); err != nil {
63
-		return err
64
-	}
65 62
 
66 63
 	return ForceMount("", mountPoint, "none", options)
67 64
 }