mirror of
https://github.com/pgsty/minio.git
synced 2026-10-17 07:05:59 +03:00
fix: reset pooled NSScanner RPC responses to avoid stale usage data
NSScanner responses stream either a dataUsageEntry update or the final dataUsageCache. The grid framework recycles stream responses into a pool without resetting them, and the handler set only one field per response - so a recycled response still carried the Final (or Update) payload of an earlier scan. A remote node reading such a response accepted the stale final cache, corrupting bucket usage data across scanner cycles. Honor Recycler types when pooling stream responses, implement it for nsScannerResp, and clear the unset field at the response construction sites for defense in depth. Signed-off-by: Julien Laurenceau <julien.laurenceau@pepitedata.com>
This commit is contained in:
@@ -83,3 +83,13 @@ type nsScannerResp struct {
|
||||
Update *dataUsageEntry `msg:"u"`
|
||||
Final *dataUsageCache `msg:"f"`
|
||||
}
|
||||
|
||||
// Recycle resets the response, so that recycled responses cannot
|
||||
// leak stale scanner data into a subsequent scan.
|
||||
func (r *nsScannerResp) Recycle() {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
r.Update = nil
|
||||
r.Final = nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user