[pbs-devel] [RFC proxmox-backup 2/2] GC: add check for nested datastore

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Nov 27 15:11:28 CET 2024


these are particularly problematic since GC will walk the whole datastore tree
on the file system, and will thus pick up indices (but not chunks!) from nested
directories that are ignored in other code paths that use our regular
iterators..

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---

Notes:
    a similar check might also be sensible for mounting and should now be fairly
    easy to implement there as well..

 pbs-datastore/src/datastore.rs | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index 33bc1f72e..4c062e244 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -1150,6 +1150,17 @@ impl DataStore {
             // writer" information and thus no safe atime cutoff
             let _exclusive_lock = self.inner.chunk_store.try_exclusive_lock()?;
 
+            let (config, _digest) = pbs_config::datastore::config()?;
+            let gc_store_config: DataStoreConfig = config.lookup("datastore", &self.name())?;
+            let all_stores = config.convert_to_typed_array("datastore")?;
+            if let Err(err) = gc_store_config.ensure_not_nested(&all_stores) {
+                info!(
+                    "Current datastore path: {path}",
+                    path = gc_store_config.absolute_path()
+                );
+                bail!("Aborting GC for safety reasons: {err}");
+            }
+
             let phase1_start_time = proxmox_time::epoch_i64();
             let oldest_writer = self
                 .inner
-- 
2.39.5





More information about the pbs-devel mailing list