datastore: add manifest locking
Avoid races when updating manifest data by flocking a lock file. update_manifest is used to ensure updates always happen with the lock held. Snapshot deletion also acquires the lock, so it cannot interfere with an outstanding manifest write. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
committed by
Dietmar Maurer
parent
e07620028d
commit
1a374fcfd6
@ -1481,11 +1481,9 @@ fn set_notes(
|
||||
let allowed = (user_privs & PRIV_DATASTORE_READ) != 0;
|
||||
if !allowed { check_backup_owner(&datastore, backup_dir.group(), &userid)?; }
|
||||
|
||||
let (mut manifest, _) = datastore.load_manifest(&backup_dir)?;
|
||||
|
||||
manifest.unprotected["notes"] = notes.into();
|
||||
|
||||
datastore.store_manifest(&backup_dir, manifest)?;
|
||||
datastore.update_manifest(&backup_dir,|manifest| {
|
||||
manifest.unprotected["notes"] = notes.into();
|
||||
}).map_err(|err| format_err!("unable to update manifest blob - {}", err))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user