2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2026-11-30 06:12:16 +00:00
Daniel Hilst 2fa0e8b1c8 fix(nfslock): a dead owner does not mean the work it started has stopped
The ownership identity is one process, and what a lock protects outlives
it. A build wrapper starts each command in its own process group, so
SIGKILL on the wrapper leaves that group running. acquire proved the owner
dead and took the lock, and two builds then wrote one checkout. The build
wrapper's own cancellation path keeps the lock when a group survives
cleanup, and this recovery undid that retention: it read a dead owner and
took the lock the retention had kept.

A holder now ATTACHES each process group it starts and DETACHES it once
the group is gone. attach records lock.d/workers/<pgid>.<leader pstart>.
An owner is recoverable only when it is provably dead AND every attached
group is gone, so the retention is a fact recovery reads rather than a
directory it has to guess about.

A group is gone only when kill(0, -pgid) answers ESRCH, which is the test
the cancellation path already uses before it releases. The two now agree.
Reaping the LEADER is not enough, because its children inherit the group,
so the test is on the group and not on the leader's pid. detach applies the
same test and refuses while any process is in the group.

Reuse windows. The entry name carries the leader's start time, so removing
a record by name cannot remove that of a later group which reused the pgid.
The group test itself cannot tell a recycled pgid from the original group
and reads live for both, which costs a wait rather than admitting a second
writer. Neither can tell a worker that left its group by calling setpgid
itself; the cancellation path has the same limit, and the two agree.

An exclusive claim on the root does not override a live group. The claim
asserts no build is running, and a live group is evidence that one is.

release drops the records of groups that are gone and keeps the rest, so a
worker killed before its reap cannot make a lock unreleasable, and a live
one stops the release because rmdir refuses a non-empty directory.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 14:43:01 -03:00
2013-05-29 14:58:44 +00:00
2008-10-13 15:50:23 +00:00
2011-11-08 18:33:23 +00:00
2009-07-08 18:55:52 +00:00
2020-01-06 16:34:55 -05:00
2018-11-23 15:20:55 +08:00
2018-11-23 15:20:55 +08:00
2008-04-10 19:42:20 +00:00
2011-09-21 19:13:13 +00:00
2018-11-29 05:44:55 -05:00
2018-11-23 15:20:55 +08:00
2018-11-29 05:44:55 -05:00
2022-09-26 16:20:45 +02:00
2018-11-29 05:44:55 -05:00
2018-11-23 15:20:55 +08:00
2009-04-24 20:17:23 +00:00
2016-12-12 13:44:39 -05:00
S
Description
No description provided
245 MiB
Languages
Perl 79.3%
JavaScript 6.3%
C 3.9%
Shell 3.1%
SQLPL 2%
Other 5.2%