mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
fix: creating steep directory structure on trash folder (#14314)
weird directory structures get created on the '.trash' folder upon server restarts, this PR fixes this.
This commit is contained in:
parent
d0862ddf86
commit
03a6e8aee2
@ -98,12 +98,7 @@ func formatErasureCleanupTmp(diskPath string) {
|
|||||||
err))
|
err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := renameAll(tmpOld, pathJoin(diskPath, minioMetaTmpDeletedBucket, tmpID)); err != nil && !errors.Is(err, errFileNotFound) {
|
go removeAll(tmpOld)
|
||||||
logger.LogIf(GlobalContext, fmt.Errorf("unable to rename (%s -> %s) %w, drive may be faulty please investigate",
|
|
||||||
pathJoin(diskPath, minioMetaTmpBucket),
|
|
||||||
tmpOld,
|
|
||||||
osErrToFileErr(err)))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Renames and schedules for purging all bucket metacache.
|
// Renames and schedules for purging all bucket metacache.
|
||||||
renameAllBucketMetacache(diskPath)
|
renameAllBucketMetacache(diskPath)
|
||||||
|
@ -21,7 +21,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/hex"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@ -257,9 +256,8 @@ func newXLStorage(ep Endpoint) (s *xlStorage, err error) {
|
|||||||
|
|
||||||
if len(s.formatData) == 0 { // Unformatted disk check if O_DIRECT is supported.
|
if len(s.formatData) == 0 { // Unformatted disk check if O_DIRECT is supported.
|
||||||
// Check if backend is writable and supports O_DIRECT
|
// Check if backend is writable and supports O_DIRECT
|
||||||
var rnd [32]byte
|
uuid := mustGetUUID()
|
||||||
_, _ = rand.Read(rnd[:])
|
filePath := pathJoin(s.diskPath, ".writable-check-"+uuid+".tmp")
|
||||||
filePath := pathJoin(s.diskPath, ".writable-check-"+hex.EncodeToString(rnd[:])+".tmp")
|
|
||||||
w, err := s.openFileDirect(filePath, os.O_CREATE|os.O_WRONLY|os.O_EXCL)
|
w, err := s.openFileDirect(filePath, os.O_CREATE|os.O_WRONLY|os.O_EXCL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return s, err
|
return s, err
|
||||||
@ -272,7 +270,7 @@ func newXLStorage(ep Endpoint) (s *xlStorage, err error) {
|
|||||||
}
|
}
|
||||||
return s, err
|
return s, err
|
||||||
}
|
}
|
||||||
Remove(filePath)
|
renameAll(filePath, pathJoin(s.diskPath, minioMetaTmpDeletedBucket, uuid))
|
||||||
|
|
||||||
// Create all necessary bucket folders if possible.
|
// Create all necessary bucket folders if possible.
|
||||||
if err = makeFormatErasureMetaVolumes(s); err != nil {
|
if err = makeFormatErasureMetaVolumes(s); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user