Bladeren bron

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 6 jaren geleden
bovenliggende
commit
f01297d1ae
1 gewijzigde bestanden met toevoegingen van 1 en 4 verwijderingen
  1. 1 4
      pkg/mount/sharedsubtree_linux.go

+ 1 - 4
pkg/mount/sharedsubtree_linux.go

@@ -55,13 +55,10 @@ func ensureMountedAs(mountPoint, options string) error {
 	}
 	}
 
 
 	if !mounted {
 	if !mounted {
-		if err := Mount(mountPoint, mountPoint, "none", "bind,rw"); err != nil {
+		if err := Mount(mountPoint, mountPoint, "none", "bind"); err != nil {
 			return err
 			return err
 		}
 		}
 	}
 	}
-	if _, err = Mounted(mountPoint); err != nil {
-		return err
-	}
 
 
 	return ForceMount("", mountPoint, "none", options)
 	return ForceMount("", mountPoint, "none", options)
 }
 }