src/api2/backup.rs: aquire backup lock earlier in create_locked_backup_group()

This commit is contained in:
Dietmar Maurer
2020-07-30 10:48:33 +02:00
parent d2b0c78e23
commit 1fc82c41f2
3 changed files with 14 additions and 10 deletions

View File

@ -406,7 +406,7 @@ pub async fn pull_store(
for item in list {
let group = BackupGroup::new(&item.backup_type, &item.backup_id);
let owner = tgt_store.create_backup_group(&group, &username)?;
let (owner, _lock_guard) = tgt_store.create_locked_backup_group(&group, &username)?;
// permission check
if owner != username { // only the owner is allowed to create additional snapshots
worker.log(format!("sync group {}/{} failed - owner check failed ({} != {})",