mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
fix: Avoid teeing data into a null cache buffer (#5070)
In some cases, Cache manager returns ErrCacheFull error when creating a new cache buffer but the code still sends object data to nil cache buffer data.
This commit is contained in:
parent
8287ab091c
commit
b919462610
@ -476,12 +476,15 @@ func (xl xlObjects) PutObject(bucket string, object string, data *HashReader, me
|
||||
|
||||
// Create a new entry in memory of size.
|
||||
newBuffer, err = xl.objCache.Create(path.Join(bucket, object), data.Size())
|
||||
// Ignore error if cache is full, proceed to write the object.
|
||||
if err != nil && err != objcache.ErrCacheFull {
|
||||
// For any other error return here.
|
||||
return ObjectInfo{}, toObjectErr(traceError(err), bucket, object)
|
||||
if err == nil {
|
||||
// Cache incoming data into a buffer
|
||||
reader = io.TeeReader(data, newBuffer)
|
||||
} else {
|
||||
// Return errors other than ErrCacheFull
|
||||
if err != objcache.ErrCacheFull {
|
||||
return ObjectInfo{}, toObjectErr(traceError(err), bucket, object)
|
||||
}
|
||||
}
|
||||
reader = io.TeeReader(data, newBuffer)
|
||||
}
|
||||
|
||||
// Initialize parts metadata
|
||||
|
Loading…
Reference in New Issue
Block a user