2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2026-11-30 06:12:16 +00:00
Files
xcat-dep/lib
Daniel Hilst ba87367a7b fix(xcat-dep): a taker that dies holding lock.borrow blocks the lock for ever
Step 3 of the NFS lock protocol is mkdir(lock.borrow) and nothing recovers that
directory. A take-over killed between step 3 and step 7 leaves it behind, so
every later acquire fails step 3, skips steps 4 to 7, never evicts the dead
owner, and ends by telling the operator to remove the lock by hand. Assumption
5 made this impossible by fiat; Jenkins SIGTERM and the OOM-killer make it
routine.

The borrow now carries the same metadata as the lock, written before the death
check, which is where a signal lands. A borrow whose metadata proves its taker
dead is removed and the acquire retries; one that names a live process, or that
cannot be validated, is left alone. So the rule that recovers a dead owner now
recovers a dead taker, and staleness is still never inferred from metadata that
cannot be validated. release takes the same two steps at step 9, where a killed
taker blocked the release instead.

A guard also never released at scope exit, because the module had no DESTROY.
The lock was then held to the end of the process and no take-over could recover
it either, its owner being alive. Every caller here keeps its guards in an array
for that reason, which hid the leak. release now returns early unless this
acquisition holds the lock, because acquire blesses the object before it holds
anything and an acquire that dies would otherwise enter the wait loop in
release and never leave it.

sweep_stranded moves here from the xcat-core-ci-cd copy, which had it alone, so
the hole it covers stayed open in this copy and in xcat-core's. Its matcher read
'.lock' and '.lock.borrow', which covered mockbuild-all.pl's cell locks and
missed cluster-test.pl's .build.lock.d and sbuild-all.pl's
.sbuild-all.<arch>.nfslock. It now matches all three spellings. A borrow the
earlier protocol left carries no metadata, so the sweeper remains the only way
to clear those.

The header records that three repos vendor this file and that the copies must
stay identical.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 07:29:16 -03:00
..