From 2e7c03420fc56f7f7c9a5590efdfaf69d8049fbf Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Fri, 5 Apr 2024 21:32:43 +0200 Subject: [PATCH] lib/db: Hold update lock while taking snapshot (#9496) --- lib/db/set.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/db/set.go b/lib/db/set.go index 84cfb3452..fb4a9fda5 100644 --- a/lib/db/set.go +++ b/lib/db/set.go @@ -168,6 +168,10 @@ type Snapshot struct { func (s *FileSet) Snapshot() (*Snapshot, error) { opStr := fmt.Sprintf("%s Snapshot()", s.folder) l.Debugf(opStr) + + s.updateMutex.Lock() + defer s.updateMutex.Unlock() + t, err := s.db.newReadOnlyTransaction() if err != nil { s.db.handleFailure(err)