aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Borg <jakob@kastelo.net>2024-04-05 21:32:43 +0200
committerGitHub <noreply@github.com>2024-04-05 21:32:43 +0200
commit2e7c03420fc56f7f7c9a5590efdfaf69d8049fbf (patch)
treed9349f18292a6ac3d688bf409378f2db3dc6a67f
parentfaa56b4bb7e085fee4e8021dfbc995627dc069c1 (diff)
downloadsyncthing-2e7c03420fc56f7f7c9a5590efdfaf69d8049fbf.tar.gz
syncthing-2e7c03420fc56f7f7c9a5590efdfaf69d8049fbf.zip
lib/db: Hold update lock while taking snapshot (#9496)v1.27.6-rc.1
-rw-r--r--lib/db/set.go4
1 files changed, 4 insertions, 0 deletions
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)