mirror of
https://github.com/minio/minio.git
synced 2025-04-21 11:04:20 -04:00
sync to disk only upon successful legacy metadata rename (#10018)
This commit is contained in:
parent
3520e946a2
commit
c0adb52213
@ -1232,7 +1232,12 @@ func (s *xlStorage) renameLegacyMetadata(volume, path string) error {
|
|||||||
dstFilePath := pathJoin(filePath, xlStorageFormatFile)
|
dstFilePath := pathJoin(filePath, xlStorageFormatFile)
|
||||||
|
|
||||||
// Renaming xl.json to xl.meta should be fully synced to disk.
|
// Renaming xl.json to xl.meta should be fully synced to disk.
|
||||||
defer globalSync()
|
defer func() {
|
||||||
|
if err == nil {
|
||||||
|
// Sync to disk only upon success.
|
||||||
|
globalSync()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if err = os.Rename(srcFilePath, dstFilePath); err != nil {
|
if err = os.Rename(srcFilePath, dstFilePath); err != nil {
|
||||||
switch {
|
switch {
|
||||||
@ -2111,7 +2116,7 @@ func (s *xlStorage) RenameData(srcVolume, srcPath, dataDir, dstVolume, dstPath s
|
|||||||
return osErrToFileErr(err)
|
return osErrToFileErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sync all the directory operations.
|
// Sync all the previous directory operations.
|
||||||
globalSync()
|
globalSync()
|
||||||
|
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user