public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Sterz <s.sterz@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup v1 0/3] refactor datastore locking to use tmpfs
Date: Wed,  6 Apr 2022 11:39:52 +0200	[thread overview]
Message-ID: <20220406093955.3180508-1-s.sterz@proxmox.com> (raw)

This patch series refactors locking within the datastore trait to use
the tmpfs-backed /run directory. Instead of the actual directory
hierarchy, each backup group and snapshot gets assigned a lock file
based on a hash of the relative path within the given datastore. A
second commit also refactors the maniefst locks in the same manor.

To avoid a race condition when deleting a lock (e.g. upon group
deletion), each lock file will be stat'ed before and after acquiring
a lock. If the inodes match, we did not encounter a race condition
and are allowed to continue using the lock. Locks will be cleaned up
when their respective group/snapshot/manifest is removed.

The last commit in this series fixes a race condition that occurs when
changing the owner of a datastore.

Stefan Sterz (3):
  fix #3935: datastore/api2/backup: move datastore locking to '/run'
  fix: datastore: move manifest locking to new locking method
  fix: api: avoid race condition in set_backup_owner

 pbs-datastore/src/datastore.rs       | 171 ++++++++++++++++++---------
 pbs-datastore/src/snapshot_reader.rs |  30 +++--
 src/api2/admin/datastore.rs          |   9 +-
 src/api2/backup/environment.rs       |   4 +-
 src/api2/backup/mod.rs               |   5 +-
 src/api2/reader/mod.rs               |   7 +-
 src/backup/verify.rs                 |  12 +-
 7 files changed, 155 insertions(+), 83 deletions(-)

-- 
2.30.2





             reply	other threads:[~2022-04-06  9:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06  9:39 Stefan Sterz [this message]
2022-04-06  9:39 ` [pbs-devel] [PATCH proxmox-backup v1 1/3] fix #3935: datastore/api2/backup: move datastore locking to '/run' Stefan Sterz
2022-04-06 14:51   ` Thomas Lamprecht
2022-04-07  8:10     ` Wolfgang Bumiller
2022-04-07  8:35       ` Stefan Sterz
2022-04-07  8:45   ` Wolfgang Bumiller
2022-04-06  9:39 ` [pbs-devel] [PATCH proxmox-backup v1 2/3] fix: datastore: move manifest locking to new locking method Stefan Sterz
2022-04-07  8:52   ` Wolfgang Bumiller
2022-04-06  9:39 ` [pbs-devel] [PATCH proxmox-backup v1 3/3] fix: api: avoid race condition in set_backup_owner Stefan Sterz

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=20220406093955.3180508-1-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 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