fix(storage): S-06 — container advisory lock prevents parallel mount and concurrent writes

This commit is contained in:
2026-09-19 09:05:12 +02:00
parent 9634beb744
commit f9733dfc73
7 changed files with 280 additions and 3 deletions
+19
View File
@@ -83,6 +83,7 @@ pub struct SyncOptions {
pub checksum: bool,
pub exclude_patterns: Vec<String>,
pub quiet: bool,
pub force: bool,
}
impl Default for SyncOptions {
@@ -95,6 +96,7 @@ impl Default for SyncOptions {
checksum: false,
exclude_patterns: Vec::new(),
quiet: false,
force: false,
}
}
}
@@ -453,6 +455,23 @@ pub fn run_sync(
let start_time = Instant::now();
let mut stats = SyncStats::default();
// S-06: Advisory-Lock gegen parallelen Mount / gleichzeitigen Zugriff
if let Some((pid, host, time)) = db.check_advisory_lock()? {
if !options.force {
bail!(
"Container ist gesperrt: Wird aktuell von Prozess {} auf Host '{}' verwendet (seit UNIX-Zeit {}). Verwenden Sie --force zum Überschreiben.",
pid, host, time
);
} else if !options.quiet {
println!(
" {} Warnung: Aktiver Advisory-Lock (Prozess {} auf '{}') wird durch --force überschrieben.",
ui::yellow("[!]"),
pid,
host
);
}
}
db.set_active_dek(zeroize::Zeroizing::new(*dek));
match options.direction {