fix export db locking deadlock
This commit is contained in:
parent
7e35c81ada
commit
e3a704224f
5 changed files with 85 additions and 27 deletions
|
@ -24,7 +24,6 @@ import Annex.Export
|
|||
import Annex.Content
|
||||
import Annex.Transfer
|
||||
import Annex.CatFile
|
||||
import Annex.LockFile
|
||||
import Annex.RemoteTrackingBranch
|
||||
import Logs.Location
|
||||
import Logs.Export
|
||||
|
@ -84,12 +83,12 @@ seek o = do
|
|||
tree <- fromMaybe (giveup "unknown tree") <$>
|
||||
inRepo (Git.Ref.tree (fromMaybe (exportTreeish o) (fmap snd mtbcommitsha)))
|
||||
|
||||
withExclusiveLock (gitAnnexExportLock (uuid r)) $ do
|
||||
db <- openDb (uuid r)
|
||||
db <- openDb (uuid r)
|
||||
writeLockDbWhile db $ do
|
||||
changeExport r db tree
|
||||
unlessM (Annex.getState Annex.fast) $ do
|
||||
void $ fillExport r db tree mtbcommitsha
|
||||
closeDb db
|
||||
closeDb db
|
||||
|
||||
-- | When the treeish is a branch like master or refs/heads/master
|
||||
-- (but not refs/remotes/...), find the commit it points to
|
||||
|
|
|
@ -59,7 +59,6 @@ import Annex.Ssh
|
|||
import Annex.BloomFilter
|
||||
import Annex.UpdateInstead
|
||||
import Annex.Export
|
||||
import Annex.LockFile
|
||||
import Annex.TaggedPush
|
||||
import Annex.CurrentBranch
|
||||
import qualified Database.Export as Export
|
||||
|
@ -691,8 +690,11 @@ syncFile ebloom rs af k = onlyActionOn' k $ do
|
|||
seekExportContent :: [Remote] -> CurrBranch -> Annex Bool
|
||||
seekExportContent rs (currbranch, _) = or <$> forM rs go
|
||||
where
|
||||
go r = withExclusiveLock (gitAnnexExportLock (Remote.uuid r)) $ do
|
||||
db <- Export.openDb (Remote.uuid r)
|
||||
go r = bracket
|
||||
(Export.openDb (Remote.uuid r))
|
||||
Export.closeDb
|
||||
(\db -> Export.writeLockDbWhile db (go' r db))
|
||||
go' r db = do
|
||||
(exported, mtbcommitsha) <- case remoteAnnexTrackingBranch (Remote.gitconfig r) of
|
||||
Nothing -> nontracking r
|
||||
Just b -> do
|
||||
|
@ -706,7 +708,7 @@ seekExportContent rs (currbranch, _) = or <$> forM rs go
|
|||
Just cur -> do
|
||||
Command.Export.changeExport r db cur
|
||||
return ([mkExported cur []], mtbcommitsha)
|
||||
Export.closeDb db `after` fillexport r db (exportedTreeishes exported) mtbcommitsha
|
||||
fillexport r db (exportedTreeishes exported) mtbcommitsha
|
||||
|
||||
nontracking r = do
|
||||
exported <- getExport (Remote.uuid r)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue