Description
pkg/filestore/filestore.go:286-290 and :297-300
The unlock functions use LoadOrStore which creates a new mutex if one does not exist. If unlockFile is ever called without a matching lockFile it creates a fresh mutex and calls Unlock() on it which panics (unlocking an unlocked mutex).
Load is the correct choice — it should be impossible to unlock a path that was never locked.
Fix
Use Load instead of LoadOrStore and handle the "not found" case as a programming error.
Description
pkg/filestore/filestore.go:286-290and:297-300The unlock functions use
LoadOrStorewhich creates a new mutex if one does not exist. IfunlockFileis ever called without a matchinglockFileit creates a fresh mutex and callsUnlock()on it which panics (unlocking an unlocked mutex).Loadis the correct choice — it should be impossible to unlock a path that was never locked.Fix
Use
Loadinstead ofLoadOrStoreand handle the "not found" case as a programming error.