[pbs-devel] [RFC PATCH 2/5] fix #3935: datastore: add shared group lock to datastore

Stefan Sterz s.sterz at proxmox.com
Fri Mar 18 15:06:52 CET 2022


so far this has not been needed, added for completeness' sake

Signed-off-by: Stefan Sterz <s.sterz at proxmox.com>
---
 pbs-datastore/src/datastore.rs | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index 389ac298..c1304d1a 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -994,4 +994,14 @@ impl DataStore {
             "another backup is already running",
         )
     }
+
+    /// Acquire a shared lock on a group
+    #[allow(dead_code)]
+    pub fn lock_group_shared(&self, group: &BackupGroup) -> Result<DirLockGuard, Error> {
+        proxmox_sys::fs::lock_dir_noblock_shared(
+            &self.group_lock_path(group)?,
+            "backup group",
+            "another backup is already running",
+        )
+    }
 }
-- 
2.30.2






More information about the pbs-devel mailing list