From aaada9057d4b00485cbbded859e2d5400343caba Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Thu, 30 Oct 2014 17:04:56 -0400 Subject: [PATCH] mount: move the MakePrivate to pkg/mount The logic is unrelated to graphdriver. Signed-off-by: Vincent Batts --- mount/sharedsubtree_linux.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 mount/sharedsubtree_linux.go diff --git a/mount/sharedsubtree_linux.go b/mount/sharedsubtree_linux.go new file mode 100644 index 0000000..566ebbd --- /dev/null +++ b/mount/sharedsubtree_linux.go @@ -0,0 +1,18 @@ +// +build linux + +package mount + +func MakePrivate(mountPoint string) error { + mounted, err := Mounted(mountPoint) + if err != nil { + return err + } + + if !mounted { + if err := Mount(mountPoint, mountPoint, "none", "bind,rw"); err != nil { + return err + } + } + + return ForceMount("", mountPoint, "none", "private") +}