From 120e6eab2c4642543ca8f7f0ad4c3e9798eb1cd4 Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Wed, 8 Feb 2017 22:31:19 +0000 Subject: [PATCH] lib/sync: Fix a race in unlocker logging (fixes #3884) Other routines use atomics, hence even if we are under a lock, we should too. We might atomically store with Not sure how it happens, but it's between lines GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3974 --- lib/sync/sync.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sync/sync.go b/lib/sync/sync.go index 783ae2526..8035c7594 100644 --- a/lib/sync/sync.go +++ b/lib/sync/sync.go @@ -123,7 +123,7 @@ func (m *loggedRWMutex) Lock() { atomic.StoreInt32(&m.logUnlockers, 1) m.RWMutex.Lock() - m.logUnlockers = 0 + atomic.StoreInt32(&m.logUnlockers, 0) holder := getHolder() m.holder.Store(holder)