Commit 3ff0e3b
committed
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.1 parent 8333381 commit 3ff0e3b
1 file changed
+11
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
564 | 564 | | |
565 | 565 | | |
566 | 566 | | |
567 | | - | |
568 | 567 | | |
569 | 568 | | |
570 | 569 | | |
| |||
575 | 574 | | |
576 | 575 | | |
577 | 576 | | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | 577 | | |
585 | 578 | | |
586 | 579 | | |
| |||
605 | 598 | | |
606 | 599 | | |
607 | 600 | | |
608 | | - | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
609 | 606 | | |
| 607 | + | |
610 | 608 | | |
611 | 609 | | |
612 | 610 | | |
| |||
640 | 638 | | |
641 | 639 | | |
642 | 640 | | |
| 641 | + | |
643 | 642 | | |
644 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
645 | 648 | | |
646 | 649 | | |
647 | 650 | | |
| |||
0 commit comments