From 9c90b5e77c9ac1c8a8c701eeea5f1ec0c1c5c952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=B6ller?= Date: Sun, 22 Jul 2018 11:33:19 +0200 Subject: [PATCH] stats: use appropriate Lock func's --- fs/accounting/stats.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/accounting/stats.go b/fs/accounting/stats.go index ca0f3084c..c16f46bdb 100644 --- a/fs/accounting/stats.go +++ b/fs/accounting/stats.go @@ -102,8 +102,8 @@ func (s *StatsInfo) Bytes(bytes int64) { // GetBytes returns the number of bytes transferred so far func (s *StatsInfo) GetBytes() int64 { - s.mu.Lock() - defer s.mu.Unlock() + s.mu.RLock() + defer s.mu.RUnlock() return s.bytes } @@ -138,8 +138,8 @@ func (s *StatsInfo) Deletes(deletes int64) int64 { // ResetCounters sets the counters (bytes, checks, errors, transfers) to 0 func (s *StatsInfo) ResetCounters() { - s.mu.RLock() - defer s.mu.RUnlock() + s.mu.Lock() + defer s.mu.Unlock() s.bytes = 0 s.errors = 0 s.checks = 0 @@ -149,8 +149,8 @@ func (s *StatsInfo) ResetCounters() { // ResetErrors sets the errors count to 0 func (s *StatsInfo) ResetErrors() { - s.mu.RLock() - defer s.mu.RUnlock() + s.mu.Lock() + defer s.mu.Unlock() s.errors = 0 }