fix deadlock
Fix a deadlock that could occur after git-annex got an unlocked file, causing the command to hang indefinitely. Known to happen on vfat filesystems, possibly others. Note that a deadlock is still theoretically possible, if anything smudge --clean does causes it to run the git queue for some other reason. Apparently that doesn't happen, but will need to keep an eye on it.
This commit is contained in:
parent
82381211fa
commit
d5451afc8f
4 changed files with 36 additions and 15 deletions
|
@ -88,18 +88,23 @@ clean file = do
|
|||
b <- liftIO $ L.hGetContents stdin
|
||||
ifM fileoutsiderepo
|
||||
( liftIO $ L.hPut stdout b
|
||||
, case parseLinkTargetOrPointerLazy b of
|
||||
Just k -> do
|
||||
getMoveRaceRecovery k (toRawFilePath file)
|
||||
liftIO $ L.hPut stdout b
|
||||
Nothing -> do
|
||||
let fileref = Git.Ref.fileRef (toRawFilePath file)
|
||||
indexmeta <- catObjectMetaData fileref
|
||||
go b indexmeta =<< catKey' fileref indexmeta
|
||||
, do
|
||||
-- Avoid a potential deadlock.
|
||||
Annex.changeState $ \s -> s
|
||||
{ Annex.insmudgecleanfilter = True }
|
||||
go b
|
||||
)
|
||||
stop
|
||||
where
|
||||
go b indexmeta oldkey = ifM (shouldAnnex file indexmeta oldkey)
|
||||
go b = case parseLinkTargetOrPointerLazy b of
|
||||
Just k -> do
|
||||
getMoveRaceRecovery k (toRawFilePath file)
|
||||
liftIO $ L.hPut stdout b
|
||||
Nothing -> do
|
||||
let fileref = Git.Ref.fileRef (toRawFilePath file)
|
||||
indexmeta <- catObjectMetaData fileref
|
||||
go' b indexmeta =<< catKey' fileref indexmeta
|
||||
go' b indexmeta oldkey = ifM (shouldAnnex file indexmeta oldkey)
|
||||
( do
|
||||
-- Before git 2.5, failing to consume all stdin here
|
||||
-- would cause a SIGPIPE and crash it.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue