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.
master
poornas 5 years ago committed by Harshavardhana
parent 40fcd3dc48
commit f01d53b20f
  1. 3
      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.Copy(writer, bytes.NewReader((*bufp)[blockOffset:blockOffset+blockLength])); err != nil {
if err != io.ErrClosedPipe { if err != io.ErrClosedPipe {
logger.LogIf(ctx, err) logger.LogIf(ctx, err)
return err
} }
return err eof = true
} }
if eof { if eof {
break break

Loading…
Cancel
Save