summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-03-01 12:12:57 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-03-01 12:12:57 -0400
commit3320b791d35ccc55f0931a833b86cfcaa180b8db (patch)
treeb1ebad854e7df0c2a8253d5a90303b54356ff474
parentef9c96a39c7f333d23dc225e0ccbff6737ed128a (diff)
Fix data loss that can occur when annex.pidlock is set in a repository.
-rw-r--r--Annex/LockPool/PosixOrPid.hs10
-rw-r--r--debian/changelog1
-rw-r--r--doc/bugs/thread_blocked_indefinitely_in_an_STM_transaction__while_moving_within__a_local_clone/comment_2_aa8c82f27965df44e69fd06b34be0ece._comment11
3 files changed, 20 insertions, 2 deletions
diff --git a/Annex/LockPool/PosixOrPid.hs b/Annex/LockPool/PosixOrPid.hs
index ecf96d51f..74ac3f178 100644
--- a/Annex/LockPool/PosixOrPid.hs
+++ b/Annex/LockPool/PosixOrPid.hs
@@ -47,8 +47,14 @@ tryLockExclusive :: Maybe FileMode -> LockFile -> Annex (Maybe LockHandle)
tryLockExclusive m f = tryPidLock m f $ Posix.tryLockExclusive m f
checkLocked :: LockFile -> Annex (Maybe Bool)
-checkLocked f = Posix.checkLocked f
- `pidLockCheck` Pid.checkLocked
+checkLocked f = Posix.checkLocked f `pidLockCheck` checkpid
+ where
+ checkpid pidlock = do
+ v <- Pid.checkLocked pidlock
+ case v of
+ -- Only return true when the posix lock file exists.
+ Just _ -> Posix.checkLocked f
+ Nothing -> return Nothing
getLockStatus :: LockFile -> Annex LockStatus
getLockStatus f = Posix.getLockStatus f
diff --git a/debian/changelog b/debian/changelog
index 721c5b3aa..f49c1281e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
git-annex (6.20160230) UNRELEASED; urgency=medium
* metadata: Added -r to remove all current values of a field.
+ * Fix data loss that can occur when annex.pidlock is set in a repository.
-- Joey Hess <id@joeyh.name> Mon, 29 Feb 2016 13:00:30 -0400
diff --git a/doc/bugs/thread_blocked_indefinitely_in_an_STM_transaction__while_moving_within__a_local_clone/comment_2_aa8c82f27965df44e69fd06b34be0ece._comment b/doc/bugs/thread_blocked_indefinitely_in_an_STM_transaction__while_moving_within__a_local_clone/comment_2_aa8c82f27965df44e69fd06b34be0ece._comment
new file mode 100644
index 000000000..2c06811d8
--- /dev/null
+++ b/doc/bugs/thread_blocked_indefinitely_in_an_STM_transaction__while_moving_within__a_local_clone/comment_2_aa8c82f27965df44e69fd06b34be0ece._comment
@@ -0,0 +1,11 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 2"""
+ date="2016-03-01T16:11:37Z"
+ content="""
+A worse problem with annex.pidlock is that it completly broke checking
+whether a key is present in the repository. That could lead to data loss
+when eg, moving --to a repo with annex.pidlock set.
+
+I've fixed that related bug.
+"""]]