Re: [PATCH v2 28/29] repack_without_refs(): don't lock or unlock the packed refs
flat view
From: Jeff King <hidden>
Date: 2017-06-23 19:56:07
On Fri, Jun 23, 2017 at 09:01:46AM +0200, Michael Haggerty wrote:
Change `repack_without_refs()` to expect the packed-refs lock to be held already, and not to release the lock before returning. Change the callers to deal with lock management. This change makes it possible for callers to hold the packed-refs lock for a longer span of time, a possibility that will eventually make it possible to fix some longstanding races.
This is the sort of clue I was thinking about in my last email. :)
The only semantic change here is that `repack_without_refs()` used to forgot to release the lock in the `if (!removed)` exit path. That omission is now fixed.
s/used to forgot/previously forgot/ or similar?
quoted hunk ↗ jump to hunk
@@ -731,14 +717,12 @@ int repack_without_refs(struct ref_store *ref_store, * All packed entries disappeared while we were * acquiring the lock. */ - rollback_packed_refs(refs); + clear_packed_ref_cache(refs); return 0;
And this is the reason for the earlier "you should be able to clear the packed ref cache without holding the lock" commit, I guess. Makes sense. -Peff