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