Fix race in cleanup of othertmp directory that could result in a failure attempting to access it.
Need to create the directory after the lock is held, not before. The other racing process would need to shut down at just the wrong time, running cleanupOtherTmp. This commit was sponsored by Boyd Stephen Smith Jr. on Patreon.
This commit is contained in:
parent
aff2fd33b3
commit
a64fca92f6
2 changed files with 5 additions and 2 deletions
|
@ -27,8 +27,9 @@ withOtherTmp a = do
|
|||
addCleanup OtherTmpCleanup cleanupOtherTmp
|
||||
tmpdir <- fromRepo gitAnnexTmpOtherDir
|
||||
tmplck <- fromRepo gitAnnexTmpOtherLock
|
||||
void $ createAnnexDirectory tmpdir
|
||||
withSharedLock (const tmplck) (a tmpdir)
|
||||
withSharedLock (const tmplck) $ do
|
||||
void $ createAnnexDirectory tmpdir
|
||||
a tmpdir
|
||||
|
||||
-- | Cleans up any tmp files that were left by a previous
|
||||
-- git-annex process that got interrupted or failed to clean up after
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue