tape restore: fix datastore locking

This commit is contained in:
Dietmar Maurer 2021-04-16 09:03:39 +02:00
parent 5547f90ba7
commit 0f4721f305

View File

@ -320,6 +320,15 @@ pub fn restore(
.join(";")
);
let mut datastore_locks = Vec::new();
for store_name in store_map.used_datastores() {
// explicit create shared lock to prevent GC on newly created chunks
if let Some(store) = store_map.get_datastore(store_name) {
let shared_store_lock = store.try_shared_chunk_store_lock()?;
datastore_locks.push(shared_store_lock);
}
}
for media_id in media_id_list.iter() {
request_and_restore_media(
&worker,
@ -333,6 +342,8 @@ pub fn restore(
)?;
}
drop(datastore_locks);
task_log!(worker, "Restore mediaset '{}' done", media_set);
if let Err(err) = set_tape_device_state(&drive, "") {