mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Remove remaining empty file in unmapBindMountDevice
This commit is contained in:
parent
dd945424e1
commit
a2cbc028f4
@ -179,7 +179,19 @@ func unmapBindMountDevice(v VolumePathHandler, mapPath string, linkName string)
|
||||
return checkErr
|
||||
} else if !isMountExist {
|
||||
klog.Warningf("Warning: Unmap skipped because bind mount does not exist on the path: %v", linkPath)
|
||||
// TODO: consider deleting empty file if it exists
|
||||
|
||||
// Check if linkPath still exists
|
||||
if _, err := os.Stat(linkPath); err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
return fmt.Errorf("failed to check if path %s exists: %v", linkPath, err)
|
||||
}
|
||||
// linkPath has already been removed
|
||||
return nil
|
||||
}
|
||||
// Remove file
|
||||
if err := os.Remove(linkPath); err != nil && !os.IsNotExist(err) {
|
||||
return fmt.Errorf("failed to remove file %s: %v", linkPath, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user