summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2021-10-30 23:16:20 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2021-10-30 23:19:01 +0200
commitfb775e85a4563a063daaf87cdf510e1d46647294 (patch)
tree6c90062ae0674f0790fca534b3fb7af85da5b69b
parent86a4342f3cf55f96e93daf175146d544e30c1216 (diff)
downloadrebel-fb775e85a4563a063daaf87cdf510e1d46647294.tar
rebel-fb775e85a4563a063daaf87cdf510e1d46647294.zip
runner: do not use tmpfs for temporary build directories
-rw-r--r--crates/runner/src/init.rs14
-rw-r--r--crates/runner/src/paths.rs2
2 files changed, 9 insertions, 7 deletions
diff --git a/crates/runner/src/init.rs b/crates/runner/src/init.rs
index b2ebbe3..07631ea 100644
--- a/crates/runner/src/init.rs
+++ b/crates/runner/src/init.rs
@@ -54,16 +54,18 @@ pub fn init_runner() -> Result<()> {
fs::mkdir(paths::LAYER_STATE_DIR)?;
fs::mkdir(paths::OUTPUT_STATE_DIR)?;
- mount::mount::<_, _, _, str>(
- Some("buildtmp"),
+ fs::ensure_removed(paths::TMP_DIR)?;
+ fs::mkdir(paths::TMP_DIR)?;
+ mount::mount::<_, _, str, str>(
+ Some(paths::TMP_DIR),
paths::TMP_DIR,
- Some("tmpfs"),
- MsFlags::empty(),
+ None,
+ MsFlags::MS_BIND,
None,
)
- .context("Mounting build tmpfs failed")?;
+ .context("Failed to bind mount build tmpdir")?;
mount::mount::<str, _, str, str>(None, paths::TMP_DIR, None, MsFlags::MS_PRIVATE, None)
- .context("Failed to set MS_PRIVATE for build tmpfs")?;
+ .context("Failed to set MS_PRIVATE for build tmpdir")?;
prepare_rootfs(paths::ROOTFS_DIR)?;
diff --git a/crates/runner/src/paths.rs b/crates/runner/src/paths.rs
index 34ecdc3..ac0d758 100644
--- a/crates/runner/src/paths.rs
+++ b/crates/runner/src/paths.rs
@@ -25,7 +25,7 @@
//! │ │ ├── task.log # stdout/stderr output of the task
//! │ │ └── task.lock # task lockfile
//! │   └── ...
-//! └── tmp/ # tmpfs (mounted on start of rebel)
+//! └── tmp/ # temporary files (cleaned on start)
//!    ├── rootfs/ # unpacked rootfs.tar
//!    └── task/
//!    └── <input hash>/