From 10270a4354c0cad853937ab7015ed5f619a6e196 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 18 Jun 2024 12:12:26 +0100 Subject: [PATCH] accounting: fix race detected by the race detector --- fs/accounting/stats.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/accounting/stats.go b/fs/accounting/stats.go index 7763c1497..e46f95e5c 100644 --- a/fs/accounting/stats.go +++ b/fs/accounting/stats.go @@ -313,7 +313,9 @@ func (s *StatsInfo) calculateTransferStats() (ts transferStats) { // note that s.bytes already includes transferringBytesDone so // we take it off here to avoid double counting ts.totalBytes = s.transferQueueSize + s.bytes + transferringBytesTotal - transferringBytesDone + s.average.mu.Lock() ts.speed = s.average.speed + s.average.mu.Unlock() dt := s._totalDuration() ts.transferTime = dt.Seconds()