mirror of
https://github.com/xcat2/xcat-dep.git
synced 2026-09-30 14:55:17 +00:00
e2bc5493de
The dep builds lock trees on a shared NFS tree that the hypervisors re-export. The kernel refuses flock and fcntl locks to clients of a re-export, so every such lock fails with errno 524. XCAT::NFSLock builds a lock as a directory under a private name, with an owner record and the caller's metadata, and renames it into place. The record holds the machine id, boot id, pid, process start time and a random token. The owner removes the lock, or a process on the owner's host that proves the owner dead: another boot, no such pid, or a pid with another start time. That process takes a breaker lock and proves the owner dead again before it removes the lock. Removal renames the lock away first. Any other acquire waits up to a timeout, retrying every 3 s by default, then fails with the mv command that moves the lock away. A lock left by mockbuild-all.pl before this module is taken when its pid is gone on this host. t/nfslock.t covers each rule without NFS. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>