From f01297d1ae352bc2bf01ebf62e879c1c83cdbee4 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 11 Oct 2018 23:16:10 -0700 Subject: [PATCH] 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 --- pkg/mount/sharedsubtree_linux.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/mount/sharedsubtree_linux.go b/pkg/mount/sharedsubtree_linux.go index 538f6637a0..30a3f5b8f0 100644 --- a/pkg/mount/sharedsubtree_linux.go +++ b/pkg/mount/sharedsubtree_linux.go @@ -55,13 +55,10 @@ func ensureMountedAs(mountPoint, options string) error { } if !mounted { - if err := Mount(mountPoint, mountPoint, "none", "bind,rw"); err != nil { + if err := Mount(mountPoint, mountPoint, "none", "bind"); err != nil { return err } } - if _, err = Mounted(mountPoint); err != nil { - return err - } return ForceMount("", mountPoint, "none", options) }