From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup] snapshot locking: improve error contexts
Date: Fri, 23 Oct 2026 14:11:29 +0200 [thread overview]
Message-ID: <20261023121152.760779-1-f.gruenbichler@proxmox.com> (raw)
having the struct-debug representation logged is rather noisy, the relative
path contains all the relevant information.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
Notes:
this is still often redundant, since context higher up might contain the
API-type BackupDir, and the error itself might contain multiple copies of the
lock path, but it's still an improvement..
pbs-datastore/src/datastore.rs | 9 ++++++---
src/api2/reader/mod.rs | 4 ++--
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index d6dcce77f..665333f52 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -1870,14 +1870,14 @@ impl DataStore {
match std::fs::create_dir(backup_dir.full_path()) {
Ok(_) => {
let guard = backup_dir.lock().with_context(|| {
- format!("while creating new locked snapshot '{backup_dir:?}'")
+ format!("while creating new locked snapshot {relative_path:?}")
})?;
Ok((relative_path, true, guard))
}
Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists => {
let guard = backup_dir
.lock()
- .with_context(|| format!("while creating locked snapshot '{backup_dir:?}'"))?;
+ .with_context(|| format!("while creating locked snapshot {relative_path:?}"))?;
Ok((relative_path, false, guard))
}
Err(e) => Err(e.into()),
@@ -2838,7 +2838,10 @@ impl DataStore {
}
let _guard = backup_dir.lock().with_context(|| {
- format!("while updating the protection status of snapshot '{backup_dir:?}'")
+ format!(
+ "while updating the protection status of snapshot {:?}",
+ backup_dir.relative_path()
+ )
})?;
let protected_path = backup_dir.protected_file();
diff --git a/src/api2/reader/mod.rs b/src/api2/reader/mod.rs
index 4321d2286..29c00e74c 100644
--- a/src/api2/reader/mod.rs
+++ b/src/api2/reader/mod.rs
@@ -131,12 +131,12 @@ fn upgrade_to_backup_reader_protocol(
}
if !backup_dir.full_path().exists() {
- bail!("snapshot {} does not exist.", backup_dir.dir());
+ bail!("snapshot {:?} does not exist.", backup_dir.relative_path());
}
let _guard = backup_dir
.lock_shared()
- .with_context(|| format!("while reading snapshot '{backup_dir:?}'"))?;
+ .with_context(|| format!("while reading snapshot {:?}", backup_dir.relative_path()))?;
let path = datastore.base_path();
--
2.47.3
reply other threads:[~2026-10-23 12:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261023121152.760779-1-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