Skip to content

Commit a3cdff3

Browse files
committed
add a comment about checkSaneLock
See commit 8c2dd7d for original introduction of it, but needing to spelunk that far back to understand the code is not good.
1 parent 55bfa41 commit a3cdff3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Annex/Transfer.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ runTransfer' ignorelock t afile stalldetection retrydecider transferaction =
151151
createAnnexDirectory $ P.takeDirectory lck
152152
tryLockExclusive (Just mode) lck >>= \case
153153
Nothing -> return (Nothing, True)
154+
-- Since the lock file is removed in cleanup,
155+
-- there's a race where different processes
156+
-- may have a deleted and a new version of the same
157+
-- lock file open. checkSaneLock guards against
158+
-- that.
154159
Just lockhandle -> ifM (checkSaneLock lck lockhandle)
155160
( do
156161
createtfile

0 commit comments

Comments
 (0)