From: Stefan Sterz <s.sterz@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [RFC PATCH 3/5] fix #3935: datastore/config: add a constant for the locking directory
Date: Fri, 18 Mar 2022 15:06:53 +0100 [thread overview]
Message-ID: <20220318140655.170656-4-s.sterz@proxmox.com> (raw)
In-Reply-To: <20220318140655.170656-1-s.sterz@proxmox.com>
adds a constant to make switching the datastore lock directory
location easier
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
---
pbs-datastore/src/datastore.rs | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index c1304d1a..11bd578d 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -39,6 +39,8 @@ lazy_static! {
static ref DATASTORE_MAP: Mutex<HashMap<String, Arc<DataStore>>> = Mutex::new(HashMap::new());
}
+pub const DATASTORE_LOCKS_DIR: &str = "/run/proxmox-backup/locks";
+
/// checks if auth_id is owner, or, if owner is a token, if
/// auth_id is the user of the token
pub fn check_backup_owner(
@@ -807,7 +809,8 @@ impl DataStore {
backup_dir: &BackupDir,
) -> Result<String, Error> {
let mut path = format!(
- "/run/proxmox-backup/locks/{}/{}/{}",
+ "{}/{}/{}/{}",
+ DATASTORE_LOCKS_DIR,
self.name(),
backup_dir.group().backup_type(),
backup_dir.group().backup_id(),
@@ -949,7 +952,7 @@ impl DataStore {
}
fn snapshot_lock_path(&self, backup_dir: &BackupDir) -> Result<PathBuf, Error> {
- let path = Path::new("/run/proxmox-backup/locks")
+ let path = Path::new(DATASTORE_LOCKS_DIR)
.join(self.name())
.join(backup_dir.relative_path());
@@ -959,7 +962,7 @@ impl DataStore {
}
fn group_lock_path(&self, group: &BackupGroup) -> Result<PathBuf, Error> {
- let path = Path::new("/run/proxmox-backup/locks")
+ let path = Path::new(DATASTORE_LOCKS_DIR)
.join(self.name())
.join(group.group_path());
--
2.30.2
next prev parent reply other threads:[~2022-03-18 14:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-18 14:06 [pbs-devel] [RFC PATCH 0/5] fix #3935: refactor datastore locking to use tmpfs Stefan Sterz
2022-03-18 14:06 ` [pbs-devel] [RFC PATCH 1/5] fix #3935: datastore/api2/backup: move datastore locking to '/run' Stefan Sterz
2022-03-18 14:06 ` [pbs-devel] [RFC PATCH 2/5] fix #3935: datastore: add shared group lock to datastore Stefan Sterz
2022-03-18 14:06 ` Stefan Sterz [this message]
2022-03-18 14:06 ` [pbs-devel] [RFC PATCH 4/5] fix #3935: datastore: keep manifest locks, avoid similar locking issue Stefan Sterz
2022-03-18 14:06 ` [pbs-devel] [RFC PATCH 5/5] fix: api: avoid race condition in set_backup_owner Stefan Sterz
2022-03-22 9:38 ` [pbs-devel] [RFC PATCH 0/5] fix #3935: refactor datastore locking to use tmpfs Wolfgang Bumiller
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=20220318140655.170656-4-s.sterz@proxmox.com \
--to=s.sterz@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.