]> git.proxmox.com Git - proxmox-backup.git/commitdiff
src/api2/pull.rs: aquire try_shared_chunk_store_lock inside pull_store
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 22 May 2020 05:24:17 +0000 (07:24 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 22 May 2020 05:24:17 +0000 (07:24 +0200)
src/api2/pull.rs

index 4cb1f21c281181d9823b69b595c4a6242a39bcee..df21b2669d466bee1012f6dcc15ad3bdbf2a50cb 100644 (file)
@@ -315,6 +315,9 @@ pub async fn pull_store(
     username: String,
 ) -> Result<(), Error> {
 
+    // explicit create shared lock to prevent GC on newly created chunks
+    let _shared_store_lock = tgt_store.try_shared_chunk_store_lock()?;
+
     let path = format!("api2/json/admin/datastore/{}/groups", src_repo.store());
 
     let mut result = client.get(&path, None).await?;
@@ -431,7 +434,6 @@ async fn pull (
         user_info.check_privs(&username, &["datastore", &store], PRIV_DATASTORE_PRUNE, false)?;
     }
 
-
     let tgt_store = DataStore::lookup_datastore(&store)?;
 
     let (remote_config, _digest) = remote::config()?;
@@ -453,9 +455,6 @@ async fn pull (
 
         worker.log(format!("sync datastore '{}' start", store));
 
-        // explicit create shared lock to prevent GC on newly created chunks
-        let _shared_store_lock = tgt_store.try_shared_chunk_store_lock()?;
-
         pull_store(&worker, &client, &src_repo, tgt_store.clone(), delete, username).await?;
 
         worker.log(format!("sync datastore '{}' end", store));