2014-02-20 08:50:10 +08:00
|
|
|
// +build linux
|
|
|
|
|
2015-02-10 05:16:43 +08:00
|
|
|
package libcontainer
|
2014-02-19 08:56:11 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2015-02-10 05:16:43 +08:00
|
|
|
"io/ioutil"
|
2014-04-29 18:41:44 +08:00
|
|
|
"os"
|
2015-04-02 20:31:47 +08:00
|
|
|
"os/exec"
|
2014-04-29 18:41:44 +08:00
|
|
|
"path/filepath"
|
2015-02-27 05:08:15 +08:00
|
|
|
"strings"
|
2014-04-29 18:41:44 +08:00
|
|
|
"syscall"
|
2015-02-10 06:42:21 +08:00
|
|
|
"time"
|
2014-04-29 18:41:44 +08:00
|
|
|
|
2015-02-01 11:56:27 +08:00
|
|
|
"github.com/docker/libcontainer/configs"
|
2014-06-10 23:14:16 +08:00
|
|
|
"github.com/docker/libcontainer/label"
|
2014-02-19 08:56:11 +08:00
|
|
|
)
|
|
|
|
|
2014-02-20 08:40:36 +08:00
|
|
|
const defaultMountFlags = syscall.MS_NOEXEC | syscall.MS_NOSUID | syscall.MS_NODEV
|
2014-02-19 08:56:11 +08:00
|
|
|
|
2015-02-10 05:16:43 +08:00
|
|
|
// setupRootfs sets up the devices, mount points, and filesystems for use inside a
|
2014-06-24 20:30:27 +08:00
|
|
|
// new mount namespace.
|
2015-02-26 06:31:39 +08:00
|
|
|
func setupRootfs(config *configs.Config, console *linuxConsole) (err error) {
|
2015-02-01 11:56:27 +08:00
|
|
|
if err := prepareRoot(config); err != nil {
|
2015-02-18 13:37:02 +08:00
|
|
|
return newSystemError(err)
|
2014-02-19 08:56:11 +08:00
|
|
|
}
|
2015-03-18 02:03:28 +08:00
|
|
|
for _, m := range config.Mounts {
|
2015-04-02 20:31:47 +08:00
|
|
|
for _, precmd := range m.PremountCmds {
|
|
|
|
if err := mountCmd(precmd); err != nil {
|
|
|
|
return newSystemError(err)
|
|
|
|
}
|
|
|
|
}
|
2015-03-20 01:17:32 +08:00
|
|
|
if err := mountToRootfs(m, config.Rootfs, config.MountLabel); err != nil {
|
2015-02-18 13:37:02 +08:00
|
|
|
return newSystemError(err)
|
2014-08-27 16:51:52 +08:00
|
|
|
}
|
2015-04-02 20:31:47 +08:00
|
|
|
|
|
|
|
for _, postcmd := range m.PostmountCmds {
|
|
|
|
if err := mountCmd(postcmd); err != nil {
|
|
|
|
return newSystemError(err)
|
|
|
|
}
|
|
|
|
}
|
2014-04-11 07:03:52 +08:00
|
|
|
}
|
2015-02-04 09:44:58 +08:00
|
|
|
if err := createDevices(config); err != nil {
|
2015-02-18 13:37:02 +08:00
|
|
|
return newSystemError(err)
|
2014-05-20 04:46:59 +08:00
|
|
|
}
|
2015-02-26 06:31:39 +08:00
|
|
|
if err := setupPtmx(config, console); err != nil {
|
2015-02-18 13:37:02 +08:00
|
|
|
return newSystemError(err)
|
2014-02-19 08:56:11 +08:00
|
|
|
}
|
2014-07-17 02:33:43 +08:00
|
|
|
// stdin, stdout and stderr could be pointing to /dev/null from parent namespace.
|
2015-02-18 13:37:02 +08:00
|
|
|
// re-open them inside this namespace.
|
|
|
|
if err := reOpenDevNull(config.Rootfs); err != nil {
|
|
|
|
return newSystemError(err)
|
2014-07-17 02:33:43 +08:00
|
|
|
}
|
2015-02-04 09:44:58 +08:00
|
|
|
if err := setupDevSymlinks(config.Rootfs); err != nil {
|
2015-02-18 13:37:02 +08:00
|
|
|
return newSystemError(err)
|
2014-05-12 20:41:07 +08:00
|
|
|
}
|
2015-02-04 09:44:58 +08:00
|
|
|
if err := syscall.Chdir(config.Rootfs); err != nil {
|
2015-02-18 13:37:02 +08:00
|
|
|
return newSystemError(err)
|
2014-02-19 08:56:11 +08:00
|
|
|
}
|
2015-02-01 11:56:27 +08:00
|
|
|
if config.NoPivotRoot {
|
2015-02-04 09:44:58 +08:00
|
|
|
err = msMoveRoot(config.Rootfs)
|
2014-03-07 11:30:52 +08:00
|
|
|
} else {
|
2015-02-04 09:44:58 +08:00
|
|
|
err = pivotRoot(config.Rootfs, config.PivotDir)
|
2014-04-11 23:06:56 +08:00
|
|
|
}
|
|
|
|
if err != nil {
|
2015-02-18 13:37:02 +08:00
|
|
|
return newSystemError(err)
|
2014-03-07 11:30:52 +08:00
|
|
|
}
|
2015-02-04 09:44:58 +08:00
|
|
|
if config.Readonlyfs {
|
2015-02-01 11:56:27 +08:00
|
|
|
if err := setReadonly(); err != nil {
|
2015-02-18 13:37:02 +08:00
|
|
|
return newSystemError(err)
|
2014-03-21 22:17:17 +08:00
|
|
|
}
|
|
|
|
}
|
2014-07-15 07:55:49 +08:00
|
|
|
syscall.Umask(0022)
|
2014-03-07 11:30:52 +08:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-04-02 20:31:47 +08:00
|
|
|
func mountCmd(cmd configs.Command) error {
|
|
|
|
|
|
|
|
command := exec.Command(cmd.Path, cmd.Args[:]...)
|
|
|
|
command.Env = cmd.Env
|
|
|
|
command.Dir = cmd.Dir
|
|
|
|
if out, err := command.CombinedOutput(); err != nil {
|
|
|
|
return fmt.Errorf("%s failed: %s: %v", cmd, string(out), err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-03-20 01:17:32 +08:00
|
|
|
func mountToRootfs(m *configs.Mount, rootfs, mountLabel string) error {
|
2015-02-13 08:23:05 +08:00
|
|
|
var (
|
2015-02-27 05:08:15 +08:00
|
|
|
dest = m.Destination
|
2015-02-13 08:23:05 +08:00
|
|
|
data = label.FormatMountLabel(m.Data, mountLabel)
|
|
|
|
)
|
2015-02-27 05:08:15 +08:00
|
|
|
if !strings.HasPrefix(dest, rootfs) {
|
|
|
|
dest = filepath.Join(rootfs, dest)
|
|
|
|
}
|
|
|
|
|
2015-02-13 08:23:05 +08:00
|
|
|
switch m.Device {
|
2015-04-07 11:12:59 +08:00
|
|
|
case "proc", "sysfs":
|
2015-02-13 08:23:05 +08:00
|
|
|
if err := os.MkdirAll(dest, 0755); err != nil && !os.IsExist(err) {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return syscall.Mount(m.Source, dest, m.Device, uintptr(m.Flags), "")
|
2015-04-07 11:12:59 +08:00
|
|
|
case "mqueue":
|
|
|
|
if err := os.MkdirAll(dest, 0755); err != nil && !os.IsExist(err) {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if err := syscall.Mount(m.Source, dest, m.Device, uintptr(m.Flags), ""); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return label.SetFileLabel(dest, mountLabel)
|
2015-03-11 23:12:55 +08:00
|
|
|
case "tmpfs":
|
|
|
|
stat, err := os.Stat(dest)
|
|
|
|
if err != nil {
|
|
|
|
if err := os.MkdirAll(dest, 0755); err != nil && !os.IsExist(err) {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if err := syscall.Mount(m.Source, dest, m.Device, uintptr(m.Flags), data); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if stat != nil {
|
|
|
|
if err = os.Chmod(dest, stat.Mode()); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
2015-03-17 02:05:20 +08:00
|
|
|
case "devpts":
|
2015-02-13 08:23:05 +08:00
|
|
|
if err := os.MkdirAll(dest, 0755); err != nil && !os.IsExist(err) {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return syscall.Mount(m.Source, dest, m.Device, uintptr(m.Flags), data)
|
|
|
|
case "bind":
|
|
|
|
stat, err := os.Stat(m.Source)
|
|
|
|
if err != nil {
|
|
|
|
// error out if the source of a bind mount does not exist as we will be
|
|
|
|
// unable to bind anything to it.
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if err := createIfNotExists(dest, stat.IsDir()); err != nil {
|
2015-02-10 06:22:52 +08:00
|
|
|
return err
|
2014-02-19 08:56:11 +08:00
|
|
|
}
|
2015-02-13 08:23:05 +08:00
|
|
|
if err := syscall.Mount(m.Source, dest, m.Device, uintptr(m.Flags), data); err != nil {
|
2015-02-10 06:22:52 +08:00
|
|
|
return err
|
2014-02-19 08:56:11 +08:00
|
|
|
}
|
2015-02-13 08:23:05 +08:00
|
|
|
if m.Flags&syscall.MS_RDONLY != 0 {
|
|
|
|
if err := syscall.Mount(m.Source, dest, m.Device, uintptr(m.Flags|syscall.MS_REMOUNT), ""); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if m.Relabel != "" {
|
|
|
|
if err := label.Relabel(m.Source, mountLabel, m.Relabel); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if m.Flags&syscall.MS_PRIVATE != 0 {
|
|
|
|
if err := syscall.Mount("", dest, "none", uintptr(syscall.MS_PRIVATE), ""); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return fmt.Errorf("unknown mount device %q to %q", m.Device, m.Destination)
|
2014-02-19 08:56:11 +08:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2014-05-12 20:41:07 +08:00
|
|
|
func setupDevSymlinks(rootfs string) error {
|
|
|
|
var links = [][2]string{
|
|
|
|
{"/proc/self/fd", "/dev/fd"},
|
|
|
|
{"/proc/self/fd/0", "/dev/stdin"},
|
|
|
|
{"/proc/self/fd/1", "/dev/stdout"},
|
|
|
|
{"/proc/self/fd/2", "/dev/stderr"},
|
|
|
|
}
|
|
|
|
// kcore support can be toggled with CONFIG_PROC_KCORE; only create a symlink
|
|
|
|
// in /dev if it exists in /proc.
|
|
|
|
if _, err := os.Stat("/proc/kcore"); err == nil {
|
|
|
|
links = append(links, [2]string{"/proc/kcore", "/dev/kcore"})
|
|
|
|
}
|
|
|
|
for _, link := range links {
|
|
|
|
var (
|
|
|
|
src = link[0]
|
|
|
|
dst = filepath.Join(rootfs, link[1])
|
|
|
|
)
|
|
|
|
if err := os.Symlink(src, dst); err != nil && !os.IsExist(err) {
|
|
|
|
return fmt.Errorf("symlink %s %s %s", src, dst, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-02-14 08:06:17 +08:00
|
|
|
// If stdin, stdout or stderr are pointing to '/dev/null' in the global mount namespace,
|
|
|
|
// this method will make them point to '/dev/null' in this namespace.
|
2014-07-17 02:33:43 +08:00
|
|
|
func reOpenDevNull(rootfs string) error {
|
|
|
|
var stat, devNullStat syscall.Stat_t
|
|
|
|
file, err := os.Open(filepath.Join(rootfs, "/dev/null"))
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("Failed to open /dev/null - %s", err)
|
|
|
|
}
|
|
|
|
defer file.Close()
|
2015-02-13 08:23:05 +08:00
|
|
|
if err := syscall.Fstat(int(file.Fd()), &devNullStat); err != nil {
|
|
|
|
return err
|
2014-07-17 02:33:43 +08:00
|
|
|
}
|
|
|
|
for fd := 0; fd < 3; fd++ {
|
2015-02-13 08:23:05 +08:00
|
|
|
if err := syscall.Fstat(fd, &stat); err != nil {
|
|
|
|
return err
|
2014-07-17 02:33:43 +08:00
|
|
|
}
|
|
|
|
if stat.Rdev == devNullStat.Rdev {
|
|
|
|
// Close and re-open the fd.
|
2015-02-13 08:23:05 +08:00
|
|
|
if err := syscall.Dup2(int(file.Fd()), fd); err != nil {
|
|
|
|
return err
|
2014-07-17 02:33:43 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
2015-02-01 11:56:27 +08:00
|
|
|
|
|
|
|
// Create the device nodes in the container.
|
2015-02-04 09:44:58 +08:00
|
|
|
func createDevices(config *configs.Config) error {
|
2015-02-01 11:56:27 +08:00
|
|
|
oldMask := syscall.Umask(0000)
|
2015-02-04 09:44:58 +08:00
|
|
|
for _, node := range config.Devices {
|
2015-03-25 08:19:12 +08:00
|
|
|
// containers running in a user namespace are not allowed to mknod
|
|
|
|
// devices so we can just bind mount it from the host.
|
|
|
|
if err := createDeviceNode(config.Rootfs, node, config.Namespaces.Contains(configs.NEWUSER)); err != nil {
|
2015-02-01 11:56:27 +08:00
|
|
|
syscall.Umask(oldMask)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
syscall.Umask(oldMask)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Creates the device node in the rootfs of the container.
|
2015-03-25 08:19:12 +08:00
|
|
|
func createDeviceNode(rootfs string, node *configs.Device, bind bool) error {
|
2015-02-18 13:50:43 +08:00
|
|
|
dest := filepath.Join(rootfs, node.Path)
|
|
|
|
if err := os.MkdirAll(filepath.Dir(dest), 0755); err != nil {
|
2015-02-01 11:56:27 +08:00
|
|
|
return err
|
|
|
|
}
|
2015-03-25 08:19:12 +08:00
|
|
|
|
|
|
|
if bind {
|
2015-02-18 13:50:43 +08:00
|
|
|
f, err := os.Create(dest)
|
|
|
|
if err != nil && !os.IsExist(err) {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if f != nil {
|
2015-02-18 13:37:02 +08:00
|
|
|
f.Close()
|
|
|
|
}
|
2015-02-18 13:50:43 +08:00
|
|
|
return syscall.Mount(node.Path, dest, "bind", syscall.MS_BIND, "")
|
2015-02-18 13:37:02 +08:00
|
|
|
}
|
2015-03-25 08:19:12 +08:00
|
|
|
if err := mknodDevice(dest, node); err != nil {
|
|
|
|
if os.IsExist(err) {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return err
|
|
|
|
}
|
2015-02-18 13:37:02 +08:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func mknodDevice(dest string, node *configs.Device) error {
|
2015-02-01 11:56:27 +08:00
|
|
|
fileMode := node.FileMode
|
|
|
|
switch node.Type {
|
|
|
|
case 'c':
|
|
|
|
fileMode |= syscall.S_IFCHR
|
|
|
|
case 'b':
|
|
|
|
fileMode |= syscall.S_IFBLK
|
|
|
|
default:
|
|
|
|
return fmt.Errorf("%c is not a valid device type for device %s", node.Type, node.Path)
|
|
|
|
}
|
2015-02-18 13:37:02 +08:00
|
|
|
if err := syscall.Mknod(dest, uint32(fileMode), node.Mkdev()); err != nil {
|
|
|
|
return err
|
2015-02-01 11:56:27 +08:00
|
|
|
}
|
2015-02-18 13:37:02 +08:00
|
|
|
return syscall.Chown(dest, int(node.Uid), int(node.Gid))
|
2015-02-01 11:56:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func prepareRoot(config *configs.Config) error {
|
2015-04-10 22:45:04 +08:00
|
|
|
flag := syscall.MS_SLAVE | syscall.MS_REC
|
|
|
|
if config.Privatefs {
|
|
|
|
flag = syscall.MS_PRIVATE | syscall.MS_REC
|
2015-02-01 11:56:27 +08:00
|
|
|
}
|
|
|
|
if err := syscall.Mount("", "/", "", uintptr(flag), ""); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2015-02-04 09:44:58 +08:00
|
|
|
return syscall.Mount(config.Rootfs, config.Rootfs, "bind", syscall.MS_BIND|syscall.MS_REC, "")
|
2015-02-01 11:56:27 +08:00
|
|
|
}
|
2015-02-10 05:16:43 +08:00
|
|
|
|
|
|
|
func setReadonly() error {
|
|
|
|
return syscall.Mount("/", "/", "bind", syscall.MS_BIND|syscall.MS_REMOUNT|syscall.MS_RDONLY|syscall.MS_REC, "")
|
|
|
|
}
|
|
|
|
|
2015-02-26 06:31:39 +08:00
|
|
|
func setupPtmx(config *configs.Config, console *linuxConsole) error {
|
2015-02-10 05:16:43 +08:00
|
|
|
ptmx := filepath.Join(config.Rootfs, "dev/ptmx")
|
|
|
|
if err := os.Remove(ptmx); err != nil && !os.IsNotExist(err) {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if err := os.Symlink("pts/ptmx", ptmx); err != nil {
|
|
|
|
return fmt.Errorf("symlink dev ptmx %s", err)
|
|
|
|
}
|
2015-02-26 06:31:39 +08:00
|
|
|
if console != nil {
|
2015-02-18 13:37:02 +08:00
|
|
|
return console.mount(config.Rootfs, config.MountLabel, 0, 0)
|
2015-02-10 05:16:43 +08:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func pivotRoot(rootfs, pivotBaseDir string) error {
|
|
|
|
if pivotBaseDir == "" {
|
|
|
|
pivotBaseDir = "/"
|
|
|
|
}
|
|
|
|
tmpDir := filepath.Join(rootfs, pivotBaseDir)
|
|
|
|
if err := os.MkdirAll(tmpDir, 0755); err != nil {
|
|
|
|
return fmt.Errorf("can't create tmp dir %s, error %v", tmpDir, err)
|
|
|
|
}
|
|
|
|
pivotDir, err := ioutil.TempDir(tmpDir, ".pivot_root")
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("can't create pivot_root dir %s, error %v", pivotDir, err)
|
|
|
|
}
|
|
|
|
if err := syscall.PivotRoot(rootfs, pivotDir); err != nil {
|
|
|
|
return fmt.Errorf("pivot_root %s", err)
|
|
|
|
}
|
|
|
|
if err := syscall.Chdir("/"); err != nil {
|
|
|
|
return fmt.Errorf("chdir / %s", err)
|
|
|
|
}
|
|
|
|
// path to pivot dir now changed, update
|
|
|
|
pivotDir = filepath.Join(pivotBaseDir, filepath.Base(pivotDir))
|
|
|
|
if err := syscall.Unmount(pivotDir, syscall.MNT_DETACH); err != nil {
|
|
|
|
return fmt.Errorf("unmount pivot_root dir %s", err)
|
|
|
|
}
|
|
|
|
return os.Remove(pivotDir)
|
|
|
|
}
|
|
|
|
|
|
|
|
func msMoveRoot(rootfs string) error {
|
|
|
|
if err := syscall.Mount(rootfs, "/", "", syscall.MS_MOVE, ""); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if err := syscall.Chroot("."); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return syscall.Chdir("/")
|
|
|
|
}
|
2015-02-10 06:22:52 +08:00
|
|
|
|
2015-02-10 06:42:21 +08:00
|
|
|
// createIfNotExists creates a file or a directory only if it does not already exist.
|
2015-02-10 06:22:52 +08:00
|
|
|
func createIfNotExists(path string, isDir bool) error {
|
|
|
|
if _, err := os.Stat(path); err != nil {
|
|
|
|
if os.IsNotExist(err) {
|
|
|
|
if isDir {
|
2015-02-10 06:42:21 +08:00
|
|
|
return os.MkdirAll(path, 0755)
|
|
|
|
}
|
|
|
|
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
f, err := os.OpenFile(path, os.O_CREATE, 0755)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
f.Close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// remountReadonly will bind over the top of an existing path and ensure that it is read-only.
|
|
|
|
func remountReadonly(path string) error {
|
|
|
|
for i := 0; i < 5; i++ {
|
|
|
|
if err := syscall.Mount("", path, "", syscall.MS_REMOUNT|syscall.MS_RDONLY, ""); err != nil && !os.IsNotExist(err) {
|
|
|
|
switch err {
|
|
|
|
case syscall.EINVAL:
|
|
|
|
// Probably not a mountpoint, use bind-mount
|
|
|
|
if err := syscall.Mount(path, path, "", syscall.MS_BIND, ""); err != nil {
|
2015-02-10 06:22:52 +08:00
|
|
|
return err
|
|
|
|
}
|
2015-02-10 06:42:21 +08:00
|
|
|
return syscall.Mount(path, path, "", syscall.MS_BIND|syscall.MS_REMOUNT|syscall.MS_RDONLY|syscall.MS_REC|defaultMountFlags, "")
|
|
|
|
case syscall.EBUSY:
|
|
|
|
time.Sleep(100 * time.Millisecond)
|
|
|
|
continue
|
|
|
|
default:
|
|
|
|
return err
|
2015-02-10 06:22:52 +08:00
|
|
|
}
|
|
|
|
}
|
2015-02-10 06:42:21 +08:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return fmt.Errorf("unable to mount %s as readonly max retries reached", path)
|
|
|
|
}
|
|
|
|
|
2015-02-13 08:23:05 +08:00
|
|
|
// maskFile bind mounts /dev/null over the top of the specified path inside a container
|
|
|
|
// to avoid security issues from processes reading information from non-namespace aware mounts ( proc/kcore ).
|
|
|
|
func maskFile(path string) error {
|
|
|
|
if err := syscall.Mount("/dev/null", path, "", syscall.MS_BIND, ""); err != nil && !os.IsNotExist(err) {
|
|
|
|
return err
|
2015-02-10 06:22:52 +08:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|