mirror of
https://github.com/pgsty/minio.git
synced 2026-10-17 07:05:59 +03:00
a54d0c4354
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>
96 lines
3.1 KiB
Go
96 lines
3.1 KiB
Go
// Copyright (c) 2015-2024 MinIO, Inc.
|
|
//
|
|
// This file is part of MinIO Object Storage stack
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
package cmd
|
|
|
|
//go:generate msgp -file $GOFILE -unexported
|
|
|
|
const (
|
|
storageRESTVersion = "v63" // Introduce RenamePart and ReadParts API
|
|
storageRESTVersionPrefix = SlashSeparator + storageRESTVersion
|
|
storageRESTPrefix = minioReservedBucketPath + "/storage"
|
|
)
|
|
|
|
const (
|
|
storageRESTMethodHealth = "/health"
|
|
|
|
storageRESTMethodAppendFile = "/afile"
|
|
storageRESTMethodCreateFile = "/cfile"
|
|
storageRESTMethodWriteAll = "/wall"
|
|
storageRESTMethodReadVersion = "/rver"
|
|
storageRESTMethodReadXL = "/rxl"
|
|
storageRESTMethodReadAll = "/rall"
|
|
storageRESTMethodReadFile = "/rfile"
|
|
storageRESTMethodReadFileStream = "/rfilest"
|
|
storageRESTMethodListDir = "/ls"
|
|
storageRESTMethodDeleteVersions = "/dvers"
|
|
storageRESTMethodRenameFile = "/rfile"
|
|
storageRESTMethodVerifyFile = "/vfile"
|
|
storageRESTMethodStatInfoFile = "/sfile"
|
|
storageRESTMethodCleanAbandoned = "/cln"
|
|
storageRESTMethodDeleteBulk = "/dblk"
|
|
storageRESTMethodReadParts = "/rps"
|
|
)
|
|
|
|
const (
|
|
storageRESTVolume = "vol"
|
|
storageRESTVolumes = "vols"
|
|
storageRESTDirPath = "dpath"
|
|
storageRESTFilePath = "fp"
|
|
storageRESTVersionID = "vid"
|
|
storageRESTHealing = "heal"
|
|
storageRESTTotalVersions = "tvers"
|
|
storageRESTSrcVolume = "svol"
|
|
storageRESTSrcPath = "spath"
|
|
storageRESTDstVolume = "dvol"
|
|
storageRESTDstPath = "dpath"
|
|
storageRESTOffset = "offset"
|
|
storageRESTLength = "length"
|
|
storageRESTCount = "count"
|
|
storageRESTBitrotAlgo = "balg"
|
|
storageRESTBitrotHash = "bhash"
|
|
storageRESTDiskID = "did"
|
|
storageRESTForceDelete = "fdel"
|
|
storageRESTGlob = "glob"
|
|
storageRESTMetrics = "metrics"
|
|
storageRESTDriveQuorum = "dquorum"
|
|
storageRESTOrigVolume = "ovol"
|
|
storageRESTInclFreeVersions = "incl-fv"
|
|
storageRESTRange = "rng"
|
|
)
|
|
|
|
type nsScannerOptions struct {
|
|
DiskID string `msg:"id"`
|
|
ScanMode int `msg:"m"`
|
|
Cache *dataUsageCache `msg:"c"`
|
|
}
|
|
|
|
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
|
|
}
|