From 10a6a92e524ac37812913c410218a1c7c1db4446 Mon Sep 17 00:00:00 2001 From: Ankur Gupta <7876747+ankur0493@users.noreply.github.com> Date: Fri, 8 May 2020 18:15:48 +0530 Subject: [PATCH] accounting: reset bytes read during copy retry - fixes #4178 During a copy/sync command, if an operation fails due to a network issue and is retried, the underlying io.Reader is re-initialised, but the stats for bytes already read are not reset, leading to incorrect stats. THis was fixed by resetting the bytes read when an Account is re-initialized. --- fs/accounting/accounting.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/accounting/accounting.go b/fs/accounting/accounting.go index 8a541c9b1..1820b925f 100644 --- a/fs/accounting/accounting.go +++ b/fs/accounting/accounting.go @@ -138,6 +138,8 @@ func (acc *Account) UpdateReader(in io.ReadCloser) { acc.close = in acc.origIn = in acc.closed = false + acc.lpBytes = 0 + acc.bytes = int64(0) if withBuf { acc.WithBuffer() }