You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2015/09/22 02:18:42 UTC

[2/2] mesos git commit: Removed the unneeded container work directory mounts.

Removed the unneeded container work directory mounts.

Review: https://reviews.apache.org/r/38582


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/81f61414
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/81f61414
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/81f61414

Branch: refs/heads/master
Commit: 81f61414c7e26e7317eb6f14d8aa2b45e72f4396
Parents: 2871cbb
Author: Jie Yu <yu...@gmail.com>
Authored: Mon Sep 21 16:47:10 2015 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Sep 21 17:18:22 2015 -0700

----------------------------------------------------------------------
 .../isolators/filesystem/linux.cpp              | 58 ++------------------
 1 file changed, 6 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/81f61414/src/slave/containerizer/isolators/filesystem/linux.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/filesystem/linux.cpp b/src/slave/containerizer/isolators/filesystem/linux.cpp
index 57615ec..e821b27 100644
--- a/src/slave/containerizer/isolators/filesystem/linux.cpp
+++ b/src/slave/containerizer/isolators/filesystem/linux.cpp
@@ -331,54 +331,7 @@ Future<Option<ContainerPrepareInfo>> LinuxFilesystemIsolatorProcess::__prepare(
   ContainerPrepareInfo prepareInfo;
   prepareInfo.set_namespaces(CLONE_NEWNS);
 
-  if (rootfs.isNone()) {
-    // It the container does not change its root filesystem, we need
-    // to do a self bind mount of the container's work directory and
-    // mark it as a shared mount. This is necessary for any mounts
-    // underneath it to be propagated into the container's mount
-    // namespace. This is how we can update persistent volumes.
-    LOG(INFO) << "Bind mounting work directory '" << directory
-              << "' for container " << containerId;
-
-    Try<Nothing> mount = fs::mount(
-        directory,
-        directory,
-        None(),
-        MS_BIND,
-        NULL);
-
-    if (mount.isError()) {
-      return Failure(
-          "Failed to self bind mount work directory '" +
-          directory + "': " + mount.error());
-    }
-
-    mount = fs::mount(
-        None(),
-        directory,
-        None(),
-        MS_SLAVE,
-        NULL);
-
-    if (mount.isError()) {
-      return Failure(
-          "Failed to mark work directory '" + directory +
-          "' as a slave mount: " + mount.error());
-    }
-
-    mount = fs::mount(
-        None(),
-        directory,
-        None(),
-        MS_SHARED,
-        NULL);
-
-    if (mount.isError()) {
-      return Failure(
-          "Failed to mark work directory '" + directory +
-          "' as a shared mount: " + mount.error());
-    }
-  } else {
+  if (rootfs.isSome()) {
     // If the container changes its root filesystem, we need to mount
     // the container's work directory into its root filesystem
     // (creating it if needed) so that the executor and the task can
@@ -854,10 +807,11 @@ Future<Nothing> LinuxFilesystemIsolatorProcess::cleanup(
   }
 
   if (!sandboxMountExists) {
-    // This could happen if the container is not launched by this
-    // isolator (e.g., slaves prior to 0.25.0).
-    LOG(WARNING) << "Ignoring unmounting sandbox/work directory"
-                 << " for container " << containerId;
+    // This could happen if the container was not launched by this
+    // isolator (e.g., slaves prior to 0.25.0), or the container did
+    // not specify a root filesystem.
+    LOG(INFO) << "Ignoring unmounting sandbox/work directory"
+              << " for container " << containerId;
   } else {
     LOG(INFO) << "Unmounting sandbox/work directory '" << sandbox
               << "' for container " << containerId;