add a comment about checkSaneLock

See commit 8c2dd7d8ee for original
introduction of it, but needing to spelunk that far back to understand
the code is not good.
This commit is contained in:
Joey Hess 2021-10-27 14:55:30 -04:00
parent 55bfa414b3
commit a3cdff3fd5
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -151,6 +151,11 @@ runTransfer' ignorelock t afile stalldetection retrydecider transferaction =
createAnnexDirectory $ P.takeDirectory lck
tryLockExclusive (Just mode) lck >>= \case
Nothing -> return (Nothing, True)
-- Since the lock file is removed in cleanup,
-- there's a race where different processes
-- may have a deleted and a new version of the same
-- lock file open. checkSaneLock guards against
-- that.
Just lockhandle -> ifM (checkSaneLock lck lockhandle)
( do
createtfile