git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/11] builtin/maintenance: fix ref lock races when detaching
@ 2025-05-27 14:04 Patrick Steinhardt
  2025-05-27 14:04 ` [PATCH 01/11] builtin/gc: use designated field initializers for maintenance tasks Patrick Steinhardt
                   ` (13 more replies)
  0 siblings, 14 replies; 71+ messages in thread
From: Patrick Steinhardt @ 2025-05-27 14:04 UTC (permalink / raw)
  To: git; +Cc: Yonatan Roth, david asraf

Hi,

this patch series fixes races around locking the "packed-refs" file when
auto-maintenance decides to repack it. This issue has been reported e.g.
via [1] and [2].

The root cause is that git-gc(1) used to know to detach _after_ having
repacked references. As such, callers wouldn't continue with their thing
until we have already packed refs, and thus the race does not exist
there. git-maintenance(1) didn't have the same split though, so this
patch series retrofits that logic.

The series is structured as follows:

  - Patches 1 and 2 do some light refactorings.

  - Patches 3 to 5 refactor how we set up the list of tasks to not rely
    on globals anymore. Instead, we now have a single source of truth
    for which tasks exactly will be run.

  - The remaining patches introduce the split of before/after-detach
    tasks and wire them up for "pack-refs", "reflog-expire" and "gc"
    tasks.

Thanks!

Patrick

[1]: <CAJR-fbZ4X1+gN75m2dUvocR6NkowLOZ9F26cjBy8w1qd181OoQ@mail.gmail.com>
[2]: <CANi7bVAkNc+gY1NoXfJuDRjxjZLTgL8Lfn8_ZmWsvLAoiLPkNg@mail.gmail.com>

---
Patrick Steinhardt (11):
      builtin/gc: use designated field initializers for maintenance tasks
      builtin/gc: drop redundant local variable
      builtin/maintenance: centralize configuration of explicit tasks
      builtin/maintenance: mark "--task=" and "--schedule=" as incompatible
      builtin/maintenance: stop modifying global array of tasks
      builtin/maintenance: extract function to run tasks
      builtin/maintenance: fix typedef for function pointers
      builtin/maintenance: let tasks do maintenance before and after detach
      builtin/maintenance: fix locking race when packing refs and reflogs
      builtin/gc: avoid global state in `gc_before_repack()`
      builtin/maintenance: fix locking race when handling "gc" task

 builtin/gc.c           | 386 +++++++++++++++++++++++++++----------------------
 t/t7900-maintenance.sh |  19 ++-
 2 files changed, 229 insertions(+), 176 deletions(-)


---
base-commit: 845c48a16a7f7b2c44d8cb137b16a4a1f0140229
change-id: 20250527-b4-pks-maintenance-ref-lock-race-11ae5d68e06f


^ permalink raw reply	[flat|nested] 71+ messages in thread

end of thread, other threads:[~2025-06-06  5:23 UTC | newest]

Thread overview: 71+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-27 14:04 [PATCH 00/11] builtin/maintenance: fix ref lock races when detaching Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 01/11] builtin/gc: use designated field initializers for maintenance tasks Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 02/11] builtin/gc: drop redundant local variable Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 03/11] builtin/maintenance: centralize configuration of explicit tasks Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 04/11] builtin/maintenance: mark "--task=" and "--schedule=" as incompatible Patrick Steinhardt
2025-05-27 16:43   ` Ramsay Jones
2025-05-28  7:02     ` Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 05/11] builtin/maintenance: stop modifying global array of tasks Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 06/11] builtin/maintenance: extract function to run tasks Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 07/11] builtin/maintenance: fix typedef for function pointers Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 08/11] builtin/maintenance: let tasks do maintenance before and after detach Patrick Steinhardt
2025-05-27 17:01   ` Ramsay Jones
2025-05-28  7:02     ` Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 09/11] builtin/maintenance: fix locking race when packing refs and reflogs Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 10/11] builtin/gc: avoid global state in `gc_before_repack()` Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 11/11] builtin/maintenance: fix locking race when handling "gc" task Patrick Steinhardt
2025-05-30 15:08 ` [PATCH v2 00/12] builtin/maintenance: fix ref lock races when detaching Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 01/12] builtin/gc: use designated field initializers for maintenance tasks Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 02/12] builtin/gc: drop redundant local variable Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 03/12] builtin/maintenance: centralize configuration of explicit tasks Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 04/12] builtin/maintenance: mark "--task=" and "--schedule=" as incompatible Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 05/12] builtin/maintenance: stop modifying global array of tasks Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 06/12] builtin/maintenance: extract function to run tasks Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 07/12] builtin/maintenance: fix typedef for function pointers Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 08/12] builtin/maintenance: let tasks do maintenance before and after detach Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 09/12] builtin/maintenance: fix locking race when packing refs and reflogs Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 10/12] usage: allow dying without writing an error message Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 11/12] builtin/gc: avoid global state in `gc_before_repack()` Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 12/12] builtin/maintenance: fix locking race when handling "gc" task Patrick Steinhardt
2025-06-02  7:17 ` [PATCH v3 00/12] builtin/maintenance: fix ref lock races when detaching Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 01/12] builtin/gc: use designated field initializers for maintenance tasks Patrick Steinhardt
2025-06-02 10:35     ` Karthik Nayak
2025-06-02  7:17   ` [PATCH v3 02/12] builtin/gc: drop redundant local variable Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 03/12] builtin/maintenance: centralize configuration of explicit tasks Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 04/12] builtin/maintenance: mark "--task=" and "--schedule=" as incompatible Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 05/12] builtin/maintenance: stop modifying global array of tasks Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 06/12] builtin/maintenance: extract function to run tasks Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 07/12] builtin/maintenance: fix typedef for function pointers Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 08/12] builtin/maintenance: split into foreground and background tasks Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 09/12] builtin/maintenance: fix locking race when packing refs and reflogs Patrick Steinhardt
2025-06-02 10:03     ` Kristoffer Haugsbakk
2025-06-03  6:34       ` Patrick Steinhardt
2025-06-03  7:08         ` Kristoffer Haugsbakk
2025-06-02  7:17   ` [PATCH v3 10/12] usage: allow dying without writing an error message Patrick Steinhardt
2025-06-03  8:31     ` Karthik Nayak
2025-06-03  8:33       ` Kristoffer Haugsbakk
2025-06-03  9:04         ` Karthik Nayak
2025-06-03 10:46           ` Patrick Steinhardt
2025-06-03 13:45             ` Kristoffer Haugsbakk
2025-06-03 15:24     ` Junio C Hamano
2025-06-05 13:02       ` Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 11/12] builtin/gc: avoid global state in `gc_before_repack()` Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 12/12] builtin/maintenance: fix locking race when handling "gc" task Patrick Steinhardt
2025-06-03 14:01 ` [PATCH v4 00/12] builtin/maintenance: fix ref lock races when detaching Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 01/12] builtin/gc: use designated field initializers for maintenance tasks Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 02/12] builtin/gc: drop redundant local variable Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 03/12] builtin/maintenance: centralize configuration of explicit tasks Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 04/12] builtin/maintenance: mark "--task=" and "--schedule=" as incompatible Patrick Steinhardt
2025-06-05 15:46     ` Derrick Stolee
2025-06-03 14:01   ` [PATCH v4 05/12] builtin/maintenance: stop modifying global array of tasks Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 06/12] builtin/maintenance: extract function to run tasks Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 07/12] builtin/maintenance: fix typedef for function pointers Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 08/12] builtin/maintenance: split into foreground and background tasks Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 09/12] builtin/maintenance: fix locking race with refs and reflogs tasks Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 10/12] usage: allow dying without writing an error message Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 11/12] builtin/gc: avoid global state in `gc_before_repack()` Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 12/12] builtin/maintenance: fix locking race when handling "gc" task Patrick Steinhardt
2025-06-03 15:31   ` [PATCH v4 00/12] builtin/maintenance: fix ref lock races when detaching Kristoffer Haugsbakk
2025-06-04  0:35   ` Ben Knoble
2025-06-05 15:53   ` Derrick Stolee
2025-06-06  5:23     ` Patrick Steinhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).