diff options
author | Jakob Borg <jakob@kastelo.net> | 2024-04-05 21:32:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-05 21:32:43 +0200 |
commit | 2e7c03420fc56f7f7c9a5590efdfaf69d8049fbf (patch) | |
tree | d9349f18292a6ac3d688bf409378f2db3dc6a67f | |
parent | faa56b4bb7e085fee4e8021dfbc995627dc069c1 (diff) |
lib/db: Hold update lock while taking snapshot (#9496)v1.27.6-rc.1
-rw-r--r-- | lib/db/set.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/db/set.go b/lib/db/set.go index 84cfb3452d..fb4a9fda5c 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) |