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/23 22:47:22 UTC

[1/2] mesos git commit: Temporary fix for the issue when making slave's work_dir a shared mount.

Repository: mesos
Updated Branches:
  refs/heads/master 811c8bfd8 -> 2f92699e1


Temporary fix for the issue when making slave's work_dir a shared mount.

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


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

Branch: refs/heads/master
Commit: 2f92699e1ba87054a515cf82b68dc3fa76dd8c27
Parents: fe17d94
Author: Jie Yu <yu...@gmail.com>
Authored: Tue Sep 22 18:35:28 2015 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Sep 23 13:02:42 2015 -0700

----------------------------------------------------------------------
 .../isolators/filesystem/linux.cpp              | 33 +++++++-------------
 1 file changed, 11 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2f92699e/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 514b0e0..8fa929f 100644
--- a/src/slave/containerizer/isolators/filesystem/linux.cpp
+++ b/src/slave/containerizer/isolators/filesystem/linux.cpp
@@ -104,37 +104,26 @@ Try<Isolator*> LinuxFilesystemIsolatorProcess::create(
     // visible. It's OK to use the blocking os::shell here because
     // 'create' will only be invoked during initialization.
     Try<string> mount = os::shell(
-        "mount --bind %s %s",
+        "mount --bind %s %s && "
+        "mount --make-slave %s && "
+        "mount --make-shared %s",
+        flags.work_dir.c_str(),
+        flags.work_dir.c_str(),
         flags.work_dir.c_str(),
         flags.work_dir.c_str());
 
     if (mount.isError()) {
       return Error(
           "Failed to self bind mount '" + flags.work_dir +
-          "': " + mount.error());
+          "' and make it a shared mount: " + mount.error());
     }
   }
 
-  // Mark the mount as a shared+slave mount.
-  Try<string> mount = os::shell(
-      "mount --make-slave %s",
-      flags.work_dir.c_str());
-
-  if (mount.isError()) {
-    return Error(
-        "Failed to mark '" + flags.work_dir +
-        "' as a slave mount: " + mount.error());
-  }
-
-  mount = os::shell(
-      "mount --make-shared %s",
-      flags.work_dir.c_str());
-
-  if (mount.isError()) {
-    return Error(
-        "Failed to mark '" + flags.work_dir +
-        "' as a shared mount: " + mount.error());
-  }
+  // TODO(jieyu): Currently, we don't check if the slave's work_dir
+  // mount is a shared mount or not. We just assume it is. We cannot
+  // simply mark the slave as shared again because that will create a
+  // new peer group for the mounts. This is a temporary workaround for
+  // now while we are thinking about fixes.
 
   Owned<MesosIsolatorProcess> process(
       new LinuxFilesystemIsolatorProcess(flags, provisioner));


[2/2] mesos git commit: Made the mount in the bind mount backend a shared mount.

Posted by ji...@apache.org.
Made the mount in the bind mount backend a shared mount.

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


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

Branch: refs/heads/master
Commit: fe17d9417e23f46e6d7b9df8d66961bff39b6412
Parents: 811c8bf
Author: Jie Yu <yu...@gmail.com>
Authored: Tue Sep 22 16:52:14 2015 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Sep 23 13:02:42 2015 -0700

----------------------------------------------------------------------
 .../containerizer/provisioner/backends/bind.cpp | 27 ++++++++++++++++++++
 1 file changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/fe17d941/src/slave/containerizer/provisioner/backends/bind.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/provisioner/backends/bind.cpp b/src/slave/containerizer/provisioner/backends/bind.cpp
index 5cd83a6..1fe1746 100644
--- a/src/slave/containerizer/provisioner/backends/bind.cpp
+++ b/src/slave/containerizer/provisioner/backends/bind.cpp
@@ -152,6 +152,33 @@ Future<Nothing> BindBackendProcess::provision(
         mount.error());
   }
 
+  // Mark the mount as shared+slave.
+  mount = fs::mount(
+      None(),
+      rootfs,
+      None(),
+      MS_SLAVE,
+      NULL);
+
+  if (mount.isError()) {
+    return Failure(
+        "Failed to mark mount '" + rootfs +
+        "' as a slave mount: " + mount.error());
+  }
+
+  mount = fs::mount(
+      None(),
+      rootfs,
+      None(),
+      MS_SHARED,
+      NULL);
+
+  if (mount.isError()) {
+    return Failure(
+        "Failed to mark mount '" + rootfs +
+        "' as a shared mount: " + mount.error());
+  }
+
   return Nothing();
 }