|
|
|
@ -378,22 +378,23 @@ func saveFormatXL(disk StorageAPI, format interface{}, diskID string) error { |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var ignoredHiddenDirectories = []string{ |
|
|
|
|
minioMetaBucket, |
|
|
|
|
".snapshot", |
|
|
|
|
"lost+found", |
|
|
|
|
"$RECYCLE.BIN", |
|
|
|
|
"System Volume Information", |
|
|
|
|
var ignoredHiddenDirectories = map[string]struct{}{ |
|
|
|
|
minioMetaBucket: {}, |
|
|
|
|
".snapshot": {}, |
|
|
|
|
"lost+found": {}, |
|
|
|
|
"$RECYCLE.BIN": {}, |
|
|
|
|
"System Volume Information": {}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func isIgnoreHiddenDirectories(dir string) bool { |
|
|
|
|
for _, ignDir := range ignoredHiddenDirectories { |
|
|
|
|
if dir == ignDir { |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
func isHiddenDirectories(vols ...VolInfo) bool { |
|
|
|
|
for _, vol := range vols { |
|
|
|
|
if _, ok := ignoredHiddenDirectories[vol.Name]; ok { |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// loadFormatXL - loads format.json from disk.
|
|
|
|
|
func loadFormatXL(disk StorageAPI) (format *formatXLV3, err error) { |
|
|
|
@ -407,9 +408,8 @@ func loadFormatXL(disk StorageAPI) (format *formatXLV3, err error) { |
|
|
|
|
if err != nil { |
|
|
|
|
return nil, err |
|
|
|
|
} |
|
|
|
|
if len(vols) > 1 || (len(vols) == 1 && !isIgnoreHiddenDirectories(vols[0].Name)) { |
|
|
|
|
// 'format.json' not found, but we
|
|
|
|
|
// found user data.
|
|
|
|
|
if !isHiddenDirectories(vols...) { |
|
|
|
|
// 'format.json' not found, but we found user data, reject such disks.
|
|
|
|
|
return nil, errCorruptedFormat |
|
|
|
|
} |
|
|
|
|
// No other data found, its a fresh disk.
|
|
|
|
|