]> dgit.raspbian.org Git - git-annex.git/commitdiff
fix crash after drop in v10
authorJoey Hess <joeyh@joeyh.name>
Thu, 20 Jan 2022 18:00:19 +0000 (14:00 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 20 Jan 2022 18:03:27 +0000 (14:03 -0400)
After cleaning up the lock file, the content directory is gone, so
freezing it failed.

Sponsored-by: Dartmouth College's Datalad project
Annex/Content.hs

index 4895b9b182a52047be3efb7cec023bd31c1deb9e..ccec9e83138c7981382e6fcc2aca23ba477489e7 100644 (file)
@@ -243,8 +243,8 @@ lockContentUsing contentlocker key fallback a = withContentLockFile key $ \mlock
                                                cleanuplockfile lockfile
                                        liftIO $ dropLock h
                -- We have an exclusive lock, so no other process can have
-               -- the file locked, and so it's safe to remove it, as long
-               -- as all attempts to lock the file use checkSaneLock.
+               -- the lock file locked, and so it's safe to remove it, as 
+               -- long as all lock attempts use checkSaneLock.
                _ -> do
                        maybe noop cleanuplockfile mlockfile
                        liftIO $ dropLock lck
@@ -258,10 +258,10 @@ lockContentUsing contentlocker key fallback a = withContentLockFile key $ \mlock
                maybe noop cleanuplockfile mlockfile
 #endif
 
-       cleanuplockfile lockfile = modifyContent lockfile $
-               void $ liftIO $ tryIO $ do
-                       removeWhenExistsWith R.removeLink lockfile
-                       cleanObjectDirs lockfile
+       cleanuplockfile lockfile = void $ tryNonAsync $ do
+               thawContentDir lockfile
+               liftIO $ removeWhenExistsWith R.removeLink lockfile
+               liftIO $ cleanObjectDirs lockfile
 
 {- Runs an action, passing it the temp file to get,
  - and if the action succeeds, verifies the file matches