summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-03-01 12:47:07 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-03-01 12:51:54 -0400
commit77d59dd82957f92b017e1010db109069c6095ada (patch)
tree2773827301bc75fdcd325a40f1a89effd5c72e11
parentabf80814ab1b722d1c1c0c15d8a79bdd3eb56aec (diff)
Fix bug preventing moving files to/from a repository with annex.pidlock set.
-rw-r--r--Utility/LockPool/PidLock.hs2
-rw-r--r--debian/changelog1
-rw-r--r--doc/bugs/thread_blocked_indefinitely_in_an_STM_transaction__while_moving_within__a_local_clone.mdwn1
-rw-r--r--doc/bugs/thread_blocked_indefinitely_in_an_STM_transaction__while_moving_within__a_local_clone/comment_3_7e6b3ab0beaca49d7d68c9e610c1d147._comment17
4 files changed, 20 insertions, 1 deletions
diff --git a/Utility/LockPool/PidLock.hs b/Utility/LockPool/PidLock.hs
index dca353fdf..8cacd4bf6 100644
--- a/Utility/LockPool/PidLock.hs
+++ b/Utility/LockPool/PidLock.hs
@@ -33,7 +33,7 @@ import Prelude
-- Takes a pid lock, blocking until the lock is available or the timeout.
waitLock :: Seconds -> LockFile -> IO LockHandle
waitLock timeout file = makeLockHandle
- (P.waitTakeLock P.lockPool file LockExclusive)
+ (P.waitTakeLock P.lockPool file LockShared)
(mk <$> F.waitLock timeout file)
-- Tries to take a pid lock, but does not block.
diff --git a/debian/changelog b/debian/changelog
index f49c1281e..d15ca389b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,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.
+ * Fix bug preventing moving files to/from a repository with annex.pidlock set.
-- 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.mdwn b/doc/bugs/thread_blocked_indefinitely_in_an_STM_transaction__while_moving_within__a_local_clone.mdwn
index 8b8241b27..eaf79a862 100644
--- a/doc/bugs/thread_blocked_indefinitely_in_an_STM_transaction__while_moving_within__a_local_clone.mdwn
+++ b/doc/bugs/thread_blocked_indefinitely_in_an_STM_transaction__while_moving_within__a_local_clone.mdwn
@@ -37,3 +37,4 @@ and it works ok without pidlock enabled
[[!meta author=yoh]]
+> [[fixed|done]] --[[Joey]]
diff --git a/doc/bugs/thread_blocked_indefinitely_in_an_STM_transaction__while_moving_within__a_local_clone/comment_3_7e6b3ab0beaca49d7d68c9e610c1d147._comment b/doc/bugs/thread_blocked_indefinitely_in_an_STM_transaction__while_moving_within__a_local_clone/comment_3_7e6b3ab0beaca49d7d68c9e610c1d147._comment
new file mode 100644
index 000000000..becf5a1b3
--- /dev/null
+++ b/doc/bugs/thread_blocked_indefinitely_in_an_STM_transaction__while_moving_within__a_local_clone/comment_3_7e6b3ab0beaca49d7d68c9e610c1d147._comment
@@ -0,0 +1,17 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 3"""
+ date="2016-03-01T16:21:31Z"
+ content="""
+Analysis: What's crashing is Utility.LockPool.PidLock.waitLock after a call
+to Utility.LockPool.PidLock.tryLock. The former takes an exclusive STM lock
+of the pid lock file; the latter takes a shared STM lock.
+
+Since the pid lock stands in for multiple more fine-grained locks, waitLock
+will be called while a lock from tryLock (or a previous waitLock perhaps)
+is still open.
+
+The fix seems as simple as making waitLock take a shared STM lock of the
+pid lock file, leaving the exclusive lock for the later, more fine-grained
+STM lock checking that's done after taking the pid lock.
+"""]]