fs/posix: On windows use helpers and init format.json properly. (#3434)

Fixes #3433
master
Harshavardhana 8 years ago committed by GitHub
parent 6b4e6bcebf
commit 2062add05f
  1. 8
      cmd/posix.go
  2. 3
      cmd/prepare-storage.go

@ -73,7 +73,7 @@ func checkPathLength(pathName string) error {
// isDirEmpty - returns whether given directory is empty or not.
func isDirEmpty(dirname string) bool {
f, err := os.Open(dirname)
f, err := os.Open(preparePath(dirname))
if err != nil {
errorIf(func() error {
if !os.IsNotExist(err) {
@ -129,7 +129,7 @@ func newPosix(path string) (StorageAPI, error) {
}
if os.IsNotExist(err) {
// Disk not found create it.
err = os.MkdirAll(preparePath(diskPath), 0777)
err = mkdirAll(diskPath, 0777)
if err != nil {
return nil, err
}
@ -625,7 +625,7 @@ func (s *posix) createFile(volume, path string) (f *os.File, err error) {
} else {
// Create top level directories if they don't exist.
// with mode 0777 mkdir honors system umask.
if err = mkdirAll(preparePath(slashpath.Dir(filePath)), 0777); err != nil {
if err = mkdirAll(slashpath.Dir(filePath), 0777); err != nil {
// File path cannot be verified since one of the parents is a file.
if isSysErrNotDir(err) {
return nil, errFileAccessDenied
@ -935,7 +935,7 @@ func (s *posix) RenameFile(srcVolume, srcPath, dstVolume, dstPath string) (err e
// Destination does not exist, hence proceed with the rename.
}
// Creates all the parent directories, with mode 0777 mkdir honors system umask.
if err = mkdirAll(preparePath(slashpath.Dir(dstFilePath)), 0777); err != nil {
if err = mkdirAll(slashpath.Dir(dstFilePath), 0777); err != nil {
// File path cannot be verified since one of the parents is a file.
if isSysErrNotDir(err) {
return errFileAccessDenied

@ -223,7 +223,8 @@ func retryFormattingDisks(firstDisk bool, endpoints []*url.URL, storageDisks []S
if len(formatConfigs) == 1 {
err := genericFormatCheckFS(formatConfigs[0], sErrs[0])
if err != nil {
if err == errUnformattedDisk {
// For an new directory or existing data.
if err == errUnformattedDisk || err == errCorruptedFormat {
return initFormatFS(storageDisks[0])
}
return err

Loading…
Cancel
Save