harden the ephemeral-root salvage: clone, check space, lock
- clone each file with FICLONE, copy the data only where that fails - skip the salvage when the copy would leave too little free space - hold a per-container flock and one copy at a time across containers - run WriteNspawnFlags on the blocking pool
This commit is contained in:
parent
1ee481c0b1
commit
836b15a46e
1 changed files with 877 additions and 88 deletions
|
|
@ -61,6 +61,32 @@ pub(crate) fn handle_write_nspawn_flags(
|
|||
Ok((String::new(), String::new()))
|
||||
}
|
||||
|
||||
/// [`handle_write_nspawn_flags`] on the blocking pool. The root salvage inside
|
||||
/// it copies files for as long as the root is big, and would hold a runtime
|
||||
/// worker for that time.
|
||||
///
|
||||
/// # Errors
|
||||
/// As [`handle_write_nspawn_flags`], or when the task fails to join.
|
||||
pub(crate) async fn handle_write_nspawn_flags_blocking(
|
||||
container: String,
|
||||
binds: Vec<BindMount>,
|
||||
isolation: NetworkIsolation,
|
||||
load_credentials: Vec<CredentialMount>,
|
||||
hive_facts: HiveFacts,
|
||||
) -> Result<(String, String)> {
|
||||
tokio::task::spawn_blocking(move || {
|
||||
handle_write_nspawn_flags(
|
||||
&container,
|
||||
&binds,
|
||||
&isolation,
|
||||
&load_credentials,
|
||||
&hive_facts,
|
||||
)
|
||||
})
|
||||
.await
|
||||
.context("write nspawn flags task")?
|
||||
}
|
||||
|
||||
/// Validate a system-level container name (`h-` prefix for all agents,
|
||||
/// the manager included) and return the logical agent name after it.
|
||||
/// Anything else is refused, the swarm's forge and matrix containers
|
||||
|
|
|
|||
Loading…
Reference in a new issue