[pbs-devel] [PATCH proxmox v2] sys: open process_locker lockfile lazy

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Nov 28 11:04:39 CET 2023


Am 15/11/2023 um 15:31 schrieb Gabriel Goller:
> When setting a datastore in maintenance mode (offline or read-only) we
> should be able to unmount it. This isn't possible because the
> `ChunkReader` has a `ProcessLocker` instance that holds an open
> file descriptor to (f.e.) `/mnt/datastore/test1/.lock`.
> 
> The `ChunkReader` is created at startup, so if the datastore is not set
> to a maintenance mode at startup, we always have the lockfile open.
> Now we create/open the lockfile lazy, when a shared lock or a exclusive
> lock is wanted. Like this, we can set a datastore to 'offline' and
> unmount it without restarting the proxmox-backup service.
> 

I never had good experience with lazy open (or lazy unmount) so I'd like
to avoid such things if possible.

And luckily we already have a proposed solution, one that just gathered
a bit dust and where only bikeshedding questions where discussed anymore,
namely the "refactor datastore locking to use tmpfs" [0] one from Stefan
Sterz.

As with that we have a few advantages:
- no lazy opening code that needs lots of brain power to ensure it really
  is OK

- all special FS (like NFS) profit from this change too, that was even
  the original reason for the series.

- should be a bit faster to have locks in memory only

- the issue with unmount goes away too

The only potential disadvantage:

- locks are lost over (sudden) reboots, but should not matter really as
  we're mostly locking for concurrency, but still write data safely, i.e.,
  to tmpfile and then rename, so the on-disk state should always be
  consistent anyway.

Maybe you can check with Stefan how the status is, and maybe take over
his series, rebase it and see if we can get the final nits sorted out.

[0]: https://lists.proxmox.com/pipermail/pbs-devel/2022-August/005414.html





More information about the pbs-devel mailing list