Show the cause error in startup when directio is not supported (#9497)

This commit tries to create a file using direct i/o in the startup
so the server returns quickly and avoid cryptic other errors.
master
Anis Elleuch 5 years ago committed by GitHub
parent 27d716c663
commit 3e063cca5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      cmd/posix.go
  2. 2
      cmd/storage-rest-server.go

@ -175,7 +175,7 @@ func getValidPath(path string) (string, error) {
var rnd [8]byte
_, _ = rand.Read(rnd[:])
fn := pathJoin(path, ".writable-check-"+hex.EncodeToString(rnd[:])+".tmp")
file, err := os.Create(fn)
file, err := disk.OpenFileDirectIO(fn, os.O_CREATE, 0600)
if err != nil {
return path, err
}

@ -747,7 +747,7 @@ func registerStorageRESTHandlers(router *mux.Router, endpointZones EndpointZones
}
hint := fmt.Sprintf("Run the following command to add the convenient permissions: `sudo chown %s %s && sudo chmod u+rxw %s`",
username, endpoint.Path, endpoint.Path)
logger.Fatal(config.ErrUnableToWriteInBackend(err).Hint(hint),
logger.Fatal(config.ErrUnableToWriteInBackend(err).Msg(err.Error()).Hint(hint),
"Unable to initialize posix backend")
}

Loading…
Cancel
Save