mirror of
https://github.com/xcat2/xcat-dep.git
synced 2026-11-30 06:12:16 +00:00
5018b90829
_reap_borrow validates a borrow and then removes it by path. rmdir names a path, not the inode that was validated, so a contender stopped between those two steps removes whatever is at the path when it resumes. That can be a live taker's borrow, and two processes then take over one lock. No check covered it, because the existing ones drive one process at a time. The new checks fork Perl children and stop them at named points in the protocol, through an _at hook this commit adds to the module. The interleaving is a pipe barrier and not a delay, so a fast machine cannot hide the defect, and every child is reaped with its stdio detached. A contender that validated the borrow is released only after another one holds it, which is the order that reaches the defect: released together, the two race one mkdir, which is exclusive either way. A second check covers a live taker that has not written its metadata yet. An earlier revision reclaimed a borrow that two attempts found unchanged, and that rule cannot cover this case, because a live participant can pause for any length of time between two writes. Two more cover the destructor. An acquire whose commit write fails must return that write error and leave nothing for DESTROY to clean up, and release must stop after R retries rather than wait for metadata that cannot be validated. The sleep stub is capped, so a retry loop that lost its bound fails a named check instead of hanging the suite. Against the unfixed protocol 17 of the 56 checks fail, the ordered pair reporting that both contenders took the lock. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>