diff --git a/controller/internal/backup/backup.go b/controller/internal/backup/backup.go index 59e107e..4f89312 100644 --- a/controller/internal/backup/backup.go +++ b/controller/internal/backup/backup.go @@ -388,11 +388,15 @@ func (m *Manager) releaseRunning() { } // SetStackProvider sets the stack data provider for app data discovery. -// Write is protected by mutex since stackProvider is read by concurrent goroutines. +// +// M2: this MUST be called exactly once during single-threaded startup (main.go), +// before the scheduler / HTTP server / any backup goroutine starts. That write +// then happens-before all the (unlocked) reads of m.stackProvider, so no data +// race exists. The earlier mutex on this write was misleading — it implied +// runtime concurrency the reads don't honour; removed to make the init-only +// contract explicit. Do NOT call this after startup. func (m *Manager) SetStackProvider(provider StackDataProvider) { - m.mu.Lock() m.stackProvider = provider - m.mu.Unlock() } // GetStackHDDMounts returns HDD mount paths for the named stack via the stack provider.