mirror of
https://github.com/xcat2/xcat-dep.git
synced 2026-11-30 06:12:16 +00:00
56e28d4dbb
The borrow now carries metadata, so a taker that dies holding one is recovered. A borrow with NO metadata is not: _reap_borrow returns "invalid", acquire skips steps 4 to 7 for as long as the borrow exists, and the dead owner is never evicted. That is the state the earlier protocol left, because it wrote nothing into the borrow, and the state a death between mkdir and the first write leaves today. Every later acquire waits out its retries and tells the operator to remove the lock by hand. No participant holds a metadata-less borrow for longer than two file reads, and two attempts of one acquire are at least T seconds apart, so a metadata-less borrow that both attempts find unchanged is held by nobody. _reap_borrow removes that one. A borrow whose metadata file exists but does not validate may be a half-finished write and is still left alone. A lock.d with no metadata is a separate case. The build lock in xcat-core wrote none and held lock.d for the whole build, so no fact on disk tells that holder from a dead one, and acquire must keep refusing it. sweep_stranded removes it, and only with exclusive => 1, where the caller has already claimed the root and no build can be running. The refusal said "Trying to unlock <path> failed", which is the reverse of what it was doing, and gave a caller nothing to distinguish an exhausted retry budget from a mkdir that failed outright. It now reads "Cannot lock <path>: still held after N retries by <owner>". The Copies header called the xcat-dep path "this file, the original", which is false in the two copies that vendor it, and it did not say where sweep_stranded is called from. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>