summaryrefslogtreecommitdiff
path: root/Locations.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-02-17 13:04:22 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-02-17 13:30:24 -0400
commitc18aca6a6a1673d17467e25eb5c900f824c8231c (patch)
tree0ef32f822433fc6a6306db0b31640588224e19e8 /Locations.hs
parentd14b4c2a607409fbec81fedd2cc89ee77ba6a62e (diff)
avoid crash when starting fsck --incremental when one is already running
Turns out sqlite does not like having its database deleted out from underneath it. It might suffice to empty the table, but I would rather start each fsck over with a new database, so I added a lock file, and running incremental fscks use a shared lock. This leaves one concurrency bug left; running two concurrent fsck --more will lead to: "SQLite3 returned ErrorBusy while attempting to perform step." and one or both will fail. This is a concurrent writers problem.
Diffstat (limited to 'Locations.hs')
-rw-r--r--Locations.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Locations.hs b/Locations.hs
index 0cd57aa98..94c03cb91 100644
--- a/Locations.hs
+++ b/Locations.hs
@@ -58,6 +58,7 @@ module Locations (
gitAnnexRemotesDir,
gitAnnexAssistantDefaultDir,
gitAnnexFsckDb,
+ gitAnnexFsckDbLock,
isLinkToAnnex,
HashLevels(..),
hashDirMixed,
@@ -345,6 +346,10 @@ gitAnnexAssistantDefaultDir = "annex"
gitAnnexFsckDb :: Git.Repo -> FilePath
gitAnnexFsckDb r = gitAnnexDir r </> "fsck.db"
+{- Lock file for the fsck database. -}
+gitAnnexFsckDbLock :: Git.Repo -> FilePath
+gitAnnexFsckDbLock r = gitAnnexDir r </> "fsck.dbl"
+
{- Checks a symlink target to see if it appears to point to annexed content.
-
- We only look at paths inside the .git directory, and not at the .git