Repository: mesos Updated Branches: refs/heads/master 18248d0f8 -> 2c888f199
Performed a self bind mount of rootfs itself in fs::chroot::enter(). Review: https://reviews.apache.org/r/36954 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2c888f19 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2c888f19 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2c888f19 Branch: refs/heads/master Commit: 2c888f1999fe2c3aee8fe03fa2780f4269bfa27c Parents: 351a40e Author: Jie Yu <[email protected]> Authored: Thu Jul 30 15:01:47 2015 -0700 Committer: Jie Yu <[email protected]> Committed: Mon Aug 3 10:15:24 2015 -0700 ---------------------------------------------------------------------- src/linux/fs.cpp | 7 +++++++ 1 file changed, 7 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/2c888f19/src/linux/fs.cpp ---------------------------------------------------------------------- diff --git a/src/linux/fs.cpp b/src/linux/fs.cpp index ea0891e..8631d89 100644 --- a/src/linux/fs.cpp +++ b/src/linux/fs.cpp @@ -512,6 +512,13 @@ Try<Nothing> enter(const string& root) return Error("Failed to make slave mounts: " + mount.error()); } + // Bind mount 'root' itself. This is because pivot_root requires + // 'root' to be not on the same filesystem as process' current root. + mount = fs::mount(root, root, None(), MS_REC | MS_BIND, NULL); + if (mount.isError()) { + return Error("Failed to bind mount root itself: " + mount.error()); + } + // Mount special filesystems. mount = internal::mountSpecialFilesystems(root); if (mount.isError()) {
