mirror of
https://github.com/pgsty/minio.git
synced 2026-07-20 04:30:26 +03:00
fs: fix XFS and other FS related issue due to missing d_type.
This commit is contained in:
committed by
Harshavardhana
parent
188bb92d8a
commit
3de7f26e41
@@ -131,9 +131,11 @@ install: gomake-all
|
|||||||
dockerimage: checkdocker getdeps verifiers $(UI_ASSETS)
|
dockerimage: checkdocker getdeps verifiers $(UI_ASSETS)
|
||||||
@echo "Building docker image:" minio:$(TAG)
|
@echo "Building docker image:" minio:$(TAG)
|
||||||
@GO15VENDOREXPERIMENT=1 GOOS=linux GOARCH=amd64 go build --ldflags $(DOCKER_LDFLAGS) -o docker/minio.dockerimage
|
@GO15VENDOREXPERIMENT=1 GOOS=linux GOARCH=amd64 go build --ldflags $(DOCKER_LDFLAGS) -o docker/minio.dockerimage
|
||||||
|
@touch docker/dockerinit
|
||||||
@cd docker; mkdir -p export; sudo docker build --rm --tag=minio/minio:$(TAG) .
|
@cd docker; mkdir -p export; sudo docker build --rm --tag=minio/minio:$(TAG) .
|
||||||
@rmdir docker/export
|
@rmdir docker/export
|
||||||
@rm docker/minio.dockerimage
|
@rm docker/minio.dockerimage
|
||||||
|
@rm docker/dockerinit
|
||||||
|
|
||||||
release: verifiers
|
release: verifiers
|
||||||
@MINIO_RELEASE=RELEASE ./buildscripts/build.sh
|
@MINIO_RELEASE=RELEASE ./buildscripts/build.sh
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
FROM alpine:3.3
|
FROM alpine:3.3
|
||||||
RUN apk add --no-cache ca-certificates bash
|
RUN apk add --no-cache ca-certificates bash
|
||||||
ADD minio.dockerimage /minio
|
ADD minio.dockerimage /minio
|
||||||
|
ADD dockerinit /.dockerinit
|
||||||
ADD export /export
|
ADD export /export
|
||||||
EXPOSE 9000
|
EXPOSE 9000
|
||||||
COPY start.sh /start.sh
|
COPY start.sh /start.sh
|
||||||
|
|||||||
+13
-4
@@ -48,7 +48,7 @@ func clen(n []byte) int {
|
|||||||
|
|
||||||
// parseDirents - inspired from
|
// parseDirents - inspired from
|
||||||
// https://golang.org/src/syscall/syscall_<os>.go
|
// https://golang.org/src/syscall/syscall_<os>.go
|
||||||
func parseDirents(buf []byte) []fsDirent {
|
func parseDirents(dirPath string, buf []byte) []fsDirent {
|
||||||
bufidx := 0
|
bufidx := 0
|
||||||
dirents := []fsDirent{}
|
dirents := []fsDirent{}
|
||||||
for bufidx < len(buf) {
|
for bufidx < len(buf) {
|
||||||
@@ -87,7 +87,16 @@ func parseDirents(buf []byte) []fsDirent {
|
|||||||
case syscall.DT_SOCK:
|
case syscall.DT_SOCK:
|
||||||
mode = os.ModeSocket
|
mode = os.ModeSocket
|
||||||
case syscall.DT_UNKNOWN:
|
case syscall.DT_UNKNOWN:
|
||||||
mode = 0xffffffff
|
// On Linux XFS and few other file systems do not implement d_type in dirents.
|
||||||
|
// Fall back to Stat() in these scenarios.
|
||||||
|
if fi, err := os.Stat(filepath.Join(dirPath, name)); err == nil {
|
||||||
|
mode = fi.Mode()
|
||||||
|
} else {
|
||||||
|
// Stat failed, caller listing files would fail. But we will not crash
|
||||||
|
// the server.
|
||||||
|
mode = 0xffffffff
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dirents = append(dirents, fsDirent{
|
dirents = append(dirents, fsDirent{
|
||||||
@@ -115,7 +124,7 @@ func readDirAll(readDirPath, entryPrefixMatch string) ([]fsDirent, error) {
|
|||||||
if nbuf <= 0 {
|
if nbuf <= 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
for _, dirent := range parseDirents(buf[:nbuf]) {
|
for _, dirent := range parseDirents(readDirPath, buf[:nbuf]) {
|
||||||
if dirent.IsDir() {
|
if dirent.IsDir() {
|
||||||
dirent.name += string(os.PathSeparator)
|
dirent.name += string(os.PathSeparator)
|
||||||
dirent.size = 0
|
dirent.size = 0
|
||||||
@@ -151,7 +160,7 @@ func scandir(dirPath string, filter func(fsDirent) bool, namesOnly bool) ([]fsDi
|
|||||||
if nbuf <= 0 {
|
if nbuf <= 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
for _, dirent := range parseDirents(buf[:nbuf]) {
|
for _, dirent := range parseDirents(dirPath, buf[:nbuf]) {
|
||||||
if !namesOnly {
|
if !namesOnly {
|
||||||
dirent.name = filepath.Join(dirPath, dirent.name)
|
dirent.name = filepath.Join(dirPath, dirent.name)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -148,7 +148,7 @@ func initServerConfig(c *cli.Context) {
|
|||||||
|
|
||||||
// Check server arguments.
|
// Check server arguments.
|
||||||
func checkServerSyntax(c *cli.Context) {
|
func checkServerSyntax(c *cli.Context) {
|
||||||
if c.Args().First() == "help" {
|
if !c.Args().Present() || c.Args().First() == "help" {
|
||||||
cli.ShowCommandHelpAndExit(c, "server", 1)
|
cli.ShowCommandHelpAndExit(c, "server", 1)
|
||||||
}
|
}
|
||||||
if len(c.Args()) > 2 {
|
if len(c.Args()) > 2 {
|
||||||
|
|||||||
Reference in New Issue
Block a user