Gracefully handle invalid prepared volume names
This commit is contained in:
parent
b5b5c1fe8e
commit
849c441455
1 changed files with 4 additions and 1 deletions
|
@ -417,11 +417,13 @@ func checkAndStoreEASupport(path string) (isEASupportedVolume bool, err error) {
|
||||||
// First check if the manually prepared volume name is already in the map
|
// First check if the manually prepared volume name is already in the map
|
||||||
eaSupportedValue, exists := eaSupportedVolumesMap.Load(volumeName)
|
eaSupportedValue, exists := eaSupportedVolumesMap.Load(volumeName)
|
||||||
if exists {
|
if exists {
|
||||||
|
// Cache hit, immediately return the cached value
|
||||||
return eaSupportedValue.(bool), nil
|
return eaSupportedValue.(bool), nil
|
||||||
}
|
}
|
||||||
// If not found, check if EA is supported with manually prepared volume name
|
// If not found, check if EA is supported with manually prepared volume name
|
||||||
isEASupportedVolume, err = fs.PathSupportsExtendedAttributes(volumeName + `\`)
|
isEASupportedVolume, err = fs.PathSupportsExtendedAttributes(volumeName + `\`)
|
||||||
if err != nil {
|
// If the prepared volume name is not valid, we will next fetch the actual volume name.
|
||||||
|
if err != nil && !errors.Is(err, windows.DNS_ERROR_INVALID_NAME) {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -434,6 +436,7 @@ func checkAndStoreEASupport(path string) (isEASupportedVolume bool, err error) {
|
||||||
// If the actual volume name is different, check cache for the actual volume name
|
// If the actual volume name is different, check cache for the actual volume name
|
||||||
eaSupportedValue, exists := eaSupportedVolumesMap.Load(volumeNameActual)
|
eaSupportedValue, exists := eaSupportedVolumesMap.Load(volumeNameActual)
|
||||||
if exists {
|
if exists {
|
||||||
|
// Cache hit, immediately return the cached value
|
||||||
return eaSupportedValue.(bool), nil
|
return eaSupportedValue.(bool), nil
|
||||||
}
|
}
|
||||||
// If the actual volume name is different and is not in the map, again check if the new volume supports extended attributes with the actual volume name
|
// If the actual volume name is different and is not in the map, again check if the new volume supports extended attributes with the actual volume name
|
||||||
|
|
Loading…
Reference in a new issue