mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
Sync before Close() to avoid random I/O (#7638)
This commit is contained in:
parent
ac3b59645e
commit
3eb7a8bde8
@ -1087,7 +1087,7 @@ func (s *posix) CreateFile(volume, path string, fileSize int64, r io.Reader) (er
|
||||
return err
|
||||
}
|
||||
|
||||
w, err := disk.OpenFileDirectIO(filePath, os.O_CREATE|os.O_WRONLY|os.O_EXCL|os.O_SYNC, 0666)
|
||||
w, err := disk.OpenFileDirectIO(filePath, os.O_CREATE|os.O_WRONLY|os.O_EXCL, 0666)
|
||||
if err != nil {
|
||||
switch {
|
||||
case os.IsPermission(err):
|
||||
@ -1100,6 +1100,7 @@ func (s *posix) CreateFile(volume, path string, fileSize int64, r io.Reader) (er
|
||||
return err
|
||||
}
|
||||
}
|
||||
defer w.Sync() // Sync before close.
|
||||
defer w.Close()
|
||||
|
||||
var e error
|
||||
|
Loading…
Reference in New Issue
Block a user