[pbs-devel] [PATCH proxmox-backup v1 0/3] refactor datastore locking to use tmpfs

Stefan Sterz s.sterz at proxmox.com
Wed Apr 6 11:39:52 CEST 2022


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






More information about the pbs-devel mailing list