From f01d53b20f1f31aad3d3a1ca6b27f02a25cfc03d Mon Sep 17 00:00:00 2001 From: poornas Date: Tue, 22 Oct 2019 15:04:25 -0700 Subject: [PATCH] cache: do not evict entry on ErrClosedPipe (#8432) Fixes: #8431. If client prematurely closes the read end of the pipe, cache entry should not be evicted. --- cmd/disk-cache-backend.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/disk-cache-backend.go b/cmd/disk-cache-backend.go index 9c6d75c69..66a4bba77 100644 --- a/cmd/disk-cache-backend.go +++ b/cmd/disk-cache-backend.go @@ -583,8 +583,9 @@ func (c *diskCache) bitrotReadFromCache(ctx context.Context, filePath string, of if _, err := io.Copy(writer, bytes.NewReader((*bufp)[blockOffset:blockOffset+blockLength])); err != nil { if err != io.ErrClosedPipe { logger.LogIf(ctx, err) + return err } - return err + eof = true } if eof { break