mirror of
https://github.com/minio/minio.git
synced 2025-11-06 20:33:07 -05:00
fix: simplify diskMap usage to keep certain checks predictable (#12519)
Bonus: also make sure that we Sanitize() the drives only during startup of the server, but not during disk reconnects.
This commit is contained in:
@@ -233,6 +233,16 @@ func newLocalXLStorage(path string) (*xlStorage, error) {
|
||||
})
|
||||
}
|
||||
|
||||
// Sanitize - sanitizes the `format.json`, cleanup tmp.
|
||||
// all other future cleanups should be added here.
|
||||
func (s *xlStorage) Sanitize() error {
|
||||
if err := formatErasureMigrate(s.diskPath); err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
return err
|
||||
}
|
||||
|
||||
return formatErasureCleanupTmp(s.diskPath)
|
||||
}
|
||||
|
||||
// Initialize a new storage disk.
|
||||
func newXLStorage(ep Endpoint) (*xlStorage, error) {
|
||||
path := ep.Path
|
||||
@@ -302,14 +312,6 @@ func newXLStorage(ep Endpoint) (*xlStorage, error) {
|
||||
w.Close()
|
||||
Remove(filePath)
|
||||
|
||||
if err := formatErasureMigrate(p.diskPath); err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
return p, err
|
||||
}
|
||||
|
||||
if err := formatErasureCleanupTmp(p.diskPath); err != nil {
|
||||
return p, err
|
||||
}
|
||||
|
||||
// Success.
|
||||
return p, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user