public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH v2 proxmox{, -backup} 0/2] Move ProcessLocker to tmpfs
@ 2023-12-06 13:28 Gabriel Goller
  2023-12-06 13:28 ` [pbs-devel] [PATCH v2 proxmox 1/2] process_locker: use ofd locking Gabriel Goller
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Gabriel Goller @ 2023-12-06 13:28 UTC (permalink / raw)
  To: pbs-devel

This moves the `ProcessLocker`'s `.lock` file to `/run/proxmox-backup/locks` (tmpfs).

The first patch only converts all the `F_SETLK` flags to `F_OFD_SETLK` flags. This
changes normal locks, which are based on the process, to locks based on an open file
descriptor. This actually doesn't change anything, because we use mutexes, so the
lock is already thread-safe. It would be cleaner though and would safe us from
weird quirks like closing the lock-file which would drop all the locks when using
the POSIX `F_SETLK`. See more here [0].

The second patch changes the location of the `.lock` file to the `/run/proxmox-backup/locks`
tmpfs directory. Like this we don't need to lazy-lock anything and we can keep the lockfile
open all the time. Unmounting datastores is now possible as the lock file is not on the
datastore mount anymore.

Another thing is noticed is that datastores that are not available (e.g. have been unmounted)
don't display an error on the ui. That means the only way to see if a datastore is online is
to either start a gc or verify run. An idea for a future patch would be to check if the
datastore exists and (maybe) even automatically set the maintenance mode to `offline` if it
doesn't exist?

[0]: https://man7.org/linux/man-pages/man2/fcntl.2.html

Changes since version 1:
 - create directory path if it doesn't exist. (f.e. on my instance the `locks` directory 
   did not exist yet)



proxmox:

Gabriel Goller (1):
  process_locker: use ofd locking

 proxmox-sys/src/process_locker.rs | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)


proxmox-backup:

Gabriel Goller (1):
  datastore: store datastore lock on tmpfs

 pbs-datastore/src/chunk_store.rs | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)


Summary over all repositories:
  2 files changed, 23 insertions(+), 14 deletions(-)

-- 
murpp v0.4.0





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-12-06 14:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-06 13:28 [pbs-devel] [PATCH v2 proxmox{, -backup} 0/2] Move ProcessLocker to tmpfs Gabriel Goller
2023-12-06 13:28 ` [pbs-devel] [PATCH v2 proxmox 1/2] process_locker: use ofd locking Gabriel Goller
2023-12-06 13:28 ` [pbs-devel] [PATCH v2 proxmox-backup 2/2] datastore: store datastore lock on tmpfs Gabriel Goller
2023-12-06 13:41 ` [pbs-devel] [PATCH v2 proxmox{, -backup} 0/2] Move ProcessLocker to tmpfs Fabian Grünbichler
2023-12-06 13:56   ` Gabriel Goller
2023-12-06 14:14     ` Fabian Grünbichler
2023-12-06 14:21       ` Gabriel Goller
2023-12-06 14:33         ` Fabian Grünbichler
2023-12-06 14:36   ` Thomas Lamprecht
2023-12-06 14:46     ` Gabriel Goller
2023-12-06 14:58       ` Thomas Lamprecht

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