mirror of
https://github.com/xcat2/xcat-dep.git
synced 2026-11-23 02:42:24 +00:00
dd233b3331
release deleted the owner metadata and marked the guard released before it knew the removal could finish. With a live attached worker the rmdir failed on the non-empty directory, and the lock was left holding workers and no owner. acquire refuses that for ever, correctly, because there is nothing to validate, and the guard was already marked released, so nothing retried. A lock still HELD is better: it is refused with a reason, and it recovers when its owner dies. _remove had the same ordering. It deleted the metadata, then failed on the workers directory, reported "kept", and left the same wreck. A take-over recovers a dead owner's lock with completed worker records by itself, so the sweep was leaving that lock in a worse state than doing nothing. Both now clear the records of completed workers first, then ask whether the directory holds anything besides its metadata, and delete the metadata only when it does not. _only_metadata asks that question, because the unlink cannot be undone. release retries while something still blocks the removal, and marks the guard released only when nothing is left on disk. DESTROY and the signal handler that calls release_build_locks can therefore finish the job once the workers are gone. sweep_stranded's signature and its report fields are unchanged. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>