diff options
-rw-r--r-- | Annex/LockPool/PosixOrPid.hs | 7 | ||||
-rw-r--r-- | Annex/Transfer.hs | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/Annex/LockPool/PosixOrPid.hs b/Annex/LockPool/PosixOrPid.hs index cc1411800..58e597f0e 100644 --- a/Annex/LockPool/PosixOrPid.hs +++ b/Annex/LockPool/PosixOrPid.hs @@ -24,9 +24,10 @@ import Common.Annex import qualified Annex import qualified Utility.LockPool.Posix as Posix import qualified Utility.LockPool.PidLock as Pid +import qualified Utility.LockPool.LockHandle as H +import Utility.LockPool.LockHandle (LockHandle, dropLock) import Utility.LockFile.Posix (openLockFile) import Utility.LockPool.STM (LockFile) -import Utility.LockPool.LockHandle import Utility.LockFile.LockStatus import System.Posix @@ -51,6 +52,10 @@ getLockStatus :: LockFile -> Annex LockStatus getLockStatus f = Posix.getLockStatus f `pidLockCheck` Pid.getLockStatus +checkSaneLock :: LockFile -> LockHandle -> Annex Bool +checkSaneLock f h = H.checkSaneLock f h + `pidLockCheck` flip Pid.checkSaneLock h + pidLockFile :: Annex (Maybe FilePath) pidLockFile = ifM (annexPidLock <$> Annex.getGitConfig) ( Just <$> fromRepo gitAnnexPidLockFile diff --git a/Annex/Transfer.hs b/Annex/Transfer.hs index 2b0c12c8a..fe428e21a 100644 --- a/Annex/Transfer.hs +++ b/Annex/Transfer.hs @@ -96,7 +96,7 @@ runTransfer' ignorelock t file shouldretry transferobserver transferaction = do r <- tryLockExclusive (Just mode) lck case r of Nothing -> return (Nothing, True) - Just lockhandle -> ifM (liftIO $ checkSaneLock lck lockhandle) + Just lockhandle -> ifM (checkSaneLock lck lockhandle) ( do void $ liftIO $ tryIO $ writeTransferInfoFile info tfile |