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/12/11 21:18:20 UTC

[2/2] mesos git commit: Cleaned up unneccessary os exists check in linux filesystem isolator.

Cleaned up unneccessary os exists check in linux filesystem isolator.

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


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

Branch: refs/heads/master
Commit: 2e3f614bd0b10a28d7d46a31a5e292c119420e3d
Parents: 1390d22
Author: Gilbert Song <so...@gmail.com>
Authored: Fri Dec 11 12:17:57 2015 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Fri Dec 11 12:17:58 2015 -0800

----------------------------------------------------------------------
 .../mesos/isolators/filesystem/linux.cpp        | 40 +++++++++-----------
 1 file changed, 17 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2e3f614b/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp b/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
index 8442e9c..0df27d6 100644
--- a/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
+++ b/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
@@ -378,13 +378,11 @@ Future<Option<ContainerPrepareInfo>> LinuxFilesystemIsolatorProcess::__prepare(
     // Save the path 'sandbox' which will be used in 'cleanup()'.
     info->sandbox = sandbox;
 
-    if (!os::exists(sandbox)) {
-      Try<Nothing> mkdir = os::mkdir(sandbox);
-      if (mkdir.isError()) {
-        return Failure(
-            "Failed to create sandbox mount point at '" +
-            sandbox + "': " + mkdir.error());
-      }
+    Try<Nothing> mkdir = os::mkdir(sandbox);
+    if (mkdir.isError()) {
+      return Failure(
+          "Failed to create sandbox mount point at '" +
+          sandbox + "': " + mkdir.error());
     }
 
     LOG(INFO) << "Bind mounting work directory from '" << directory
@@ -530,16 +528,14 @@ Try<string> LinuxFilesystemIsolatorProcess::script(
       // work directory because a user can potentially use a container
       // path like '../../abc'.
 
-      if (!os::exists(source)) {
-        Try<Nothing> mkdir = os::mkdir(source);
-        if (mkdir.isError()) {
-          return Error(
-              "Failed to create the source of the mount at '" +
-              source + "': " + mkdir.error());
-        }
-
-        // TODO(idownes): Consider setting ownership and mode.
+      Try<Nothing> mkdir = os::mkdir(source);
+      if (mkdir.isError()) {
+        return Error(
+            "Failed to create the source of the mount at '" +
+            source + "': " + mkdir.error());
       }
+
+      // TODO(idownes): Consider setting ownership and mode.
     }
 
     // Determine the target of the mount.
@@ -575,13 +571,11 @@ Try<string> LinuxFilesystemIsolatorProcess::script(
       // sandbox because a user can potentially use a container path
       // like '../../abc'.
 
-      if (!os::exists(target)) {
-        Try<Nothing> mkdir = os::mkdir(target);
-        if (mkdir.isError()) {
-          return Error(
-              "Failed to create the target of the mount at '" +
-              target + "': " + mkdir.error());
-        }
+      Try<Nothing> mkdir = os::mkdir(target);
+      if (mkdir.isError()) {
+        return Error(
+            "Failed to create the target of the mount at '" +
+            target + "': " + mkdir.error());
       }
     }