open-nomad/client/allocdir/alloc_dir_linux.go

21 lines
418 B
Go
Raw Normal View History

package allocdir
import (
"os"
"syscall"
)
// Bind mounts the shared directory into the task directory. Must be root to
// run.
func (d *AllocDir) mountSharedDir(taskDir string) error {
2015-09-25 23:49:14 +00:00
if err := os.Mkdir(taskDir, 0777); err != nil {
return err
}
2015-09-25 23:49:14 +00:00
return syscall.Mount(d.SharedDir, taskDir, "", syscall.MS_BIND, "")
}
func (d *AllocDir) unmountSharedDir(dir string) error {
return syscall.Unmount(dir, 0)
}