mirror of
https://github.com/minio/minio.git
synced 2025-01-26 22:23:15 -05:00
parent
386dd56856
commit
a773cf48d8
@ -39,6 +39,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/dustin/go-humanize"
|
"github.com/dustin/go-humanize"
|
||||||
|
"github.com/google/uuid"
|
||||||
jsoniter "github.com/json-iterator/go"
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/klauspost/readahead"
|
"github.com/klauspost/readahead"
|
||||||
"github.com/minio/minio/cmd/config"
|
"github.com/minio/minio/cmd/config"
|
||||||
@ -1989,6 +1990,7 @@ func (s *xlStorage) RenameData(ctx context.Context, srcVolume, srcPath, dataDir,
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = os.Stat(dstVolumeDir)
|
_, err = os.Stat(dstVolumeDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if osIsNotExist(err) {
|
if osIsNotExist(err) {
|
||||||
@ -2045,6 +2047,38 @@ func (s *xlStorage) RenameData(ctx context.Context, srcVolume, srcPath, dataDir,
|
|||||||
return osErrToFileErr(err)
|
return osErrToFileErr(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if err == errFileNotFound {
|
||||||
|
// Verification to ensure that we
|
||||||
|
// don't have objects already created
|
||||||
|
// at this location, verify that resultant
|
||||||
|
// directories don't have any unexpected
|
||||||
|
// directories that we do not understand
|
||||||
|
// or expect. If its already there we should
|
||||||
|
// make sure to reject further renames
|
||||||
|
// for such objects.
|
||||||
|
//
|
||||||
|
// This elaborate check is necessary to avoid
|
||||||
|
// scenarios such as these.
|
||||||
|
//
|
||||||
|
// bucket1/name1/obj1/xl.meta
|
||||||
|
// bucket1/name1/xl.meta --> this should never
|
||||||
|
// be allowed.
|
||||||
|
{
|
||||||
|
entries, err := readDirN(path.Dir(dstFilePath), 1)
|
||||||
|
if err != nil && err != errFileNotFound {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if len(entries) > 0 {
|
||||||
|
entry := path.Clean(entries[0])
|
||||||
|
if entry != legacyDataDir {
|
||||||
|
_, uerr := uuid.Parse(entry)
|
||||||
|
if uerr != nil {
|
||||||
|
return errFileParentIsFile
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var xlMeta xlMetaV2
|
var xlMeta xlMetaV2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user