1. 11 Sep, 2012 3 commits
    • cache: fix race condition · 6ee68611
      Example: a cached node is owned only by the cache (refcount == 1).
      Thread A holds the lock and determines that the entry which should get
      cached equals the node (git_oid_cmp(&node->oid, &entry->oid) == 0).
      It frees the given entry to instead return the cached node to the user
      (entry = node). Now, before Thread A happens to increment the refcount
      of the node *outside* the cache lock, Thread B tries to store another
      entry and hits the slot of the node before, decrements its refcount and
      frees it *before* Thread A gets a chance to increment for the user.
      
      	git_cached_obj_incref(entry);
      
      	git_mutex_lock(&cache->lock);
      	{
      		git_cached_obj *node = cache->nodes[hash & cache->size_mask];
      
      		if (node == NULL) {
      			cache->nodes[hash & cache->size_mask] = entry;
      		} else if (git_oid_cmp(&node->oid, &entry->oid) == 0) {
      			git_cached_obj_decref(entry, cache->free_obj);
      			entry = node;
      		} else {
      			git_cached_obj_decref(node, cache->free_obj);
      
      // Thread B is here
      
      			cache->nodes[hash & cache->size_mask] = entry;
      		}
      	}
      	git_mutex_unlock(&cache->lock);
      
      // Thread A is here
      
      	/* increase the refcount again, because we are
      	 * returning it to the user */
      	git_cached_obj_incref(entry);
      Michael Schubert committed
    • Merge pull request #914 from authmillenon/index-fixes · 2130dee4
      Fix logical error in git_index_set_caps
      Russell Belfer committed
  2. 07 Sep, 2012 1 commit
  3. 06 Sep, 2012 11 commits
  4. 05 Sep, 2012 4 commits
  5. 04 Sep, 2012 8 commits
  6. 03 Sep, 2012 2 commits
  7. 30 Aug, 2012 1 commit
  8. 29 Aug, 2012 5 commits
  9. 28 Aug, 2012 4 commits
  10. 27 Aug, 2012 1 commit