public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [RFC proxmox-backup 2/2] GC: add check for nested datastore
Date: Wed, 27 Nov 2024 15:11:28 +0100	[thread overview]
Message-ID: <20241127141128.1123925-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20241127141128.1123925-1-f.gruenbichler@proxmox.com>

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@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



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel

  reply	other threads:[~2024-11-27 14:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-27 14:11 [pbs-devel] [PATCH proxmox-backup 1/2] datastore: extract nesting check into helper Fabian Grünbichler
2024-11-27 14:11 ` Fabian Grünbichler [this message]
2024-11-27 14:31   ` [pbs-devel] applied: [RFC proxmox-backup 2/2] GC: add check for nested datastore Thomas Lamprecht
2024-11-27 14:27 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] datastore: extract nesting check into helper Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241127141128.1123925-2-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal