• Show log

    Commit

  • Hash : 3ff0e3b5
    Author : Patrick Steinhardt
    Date : 2019-02-15T11:16:05

    refdb_fs: remove ordering dependency on loose/packed refs loading
    
    Right now, loading loose refs has the side-effect of setting the
    `PACKREF_SHADOWED` flag for references that exist both in the loose and the
    packed refs. Because of this, we are force do first look up packed refs and only
    afterwards loading the packed refs. This is susceptible to a race, though, when
    refs are being repacked: when first loading the packed cache, then it may not
    yet have the migrated loose ref. But when now trying to look up the loose
    reference afterwards, then it may already have been migrated. Thus, we would
    fail to find this reference in this scenario.
    
    Remove this ordering dependency to allow fixing the above race. Instead of
    setting the flag when loading loose refs, we will now instead set it lazily when
    iterating over the loose refs. This even has the added benefit of not requiring
    us to lock the packed refs cache, as we already have an owned copy of it.