mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 03:57:41 +00:00
Only skip unmount if path does not exist and there is no error
This commit is contained in:
parent
379daa6aff
commit
95852d7b8e
@ -30,7 +30,7 @@ import (
|
|||||||
// but properly handles bind mounts within the same fs.
|
// but properly handles bind mounts within the same fs.
|
||||||
func CleanupMountPoint(mountPath string, mounter Interface, extensiveMountPointCheck bool) error {
|
func CleanupMountPoint(mountPath string, mounter Interface, extensiveMountPointCheck bool) error {
|
||||||
pathExists, pathErr := PathExists(mountPath)
|
pathExists, pathErr := PathExists(mountPath)
|
||||||
if !pathExists {
|
if !pathExists && pathErr == nil {
|
||||||
klog.Warningf("Warning: Unmount skipped because path does not exist: %v", mountPath)
|
klog.Warningf("Warning: Unmount skipped because path does not exist: %v", mountPath)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ func CleanupMountPoint(mountPath string, mounter Interface, extensiveMountPointC
|
|||||||
|
|
||||||
func CleanupMountWithForce(mountPath string, mounter MounterForceUnmounter, extensiveMountPointCheck bool, umountTimeout time.Duration) error {
|
func CleanupMountWithForce(mountPath string, mounter MounterForceUnmounter, extensiveMountPointCheck bool, umountTimeout time.Duration) error {
|
||||||
pathExists, pathErr := PathExists(mountPath)
|
pathExists, pathErr := PathExists(mountPath)
|
||||||
if !pathExists {
|
if !pathExists && pathErr == nil {
|
||||||
klog.Warningf("Warning: Unmount skipped because path does not exist: %v", mountPath)
|
klog.Warningf("Warning: Unmount skipped because path does not exist: %v", mountPath)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -54,8 +54,10 @@ func CleanupMountWithForce(mountPath string, mounter MounterForceUnmounter, exte
|
|||||||
var notMnt bool
|
var notMnt bool
|
||||||
var err error
|
var err error
|
||||||
if !corruptedMnt {
|
if !corruptedMnt {
|
||||||
_, err = removePathIfNotMountPoint(mountPath, mounter, extensiveMountPointCheck)
|
notMnt, err = removePathIfNotMountPoint(mountPath, mounter, extensiveMountPointCheck)
|
||||||
if err != nil {
|
// if mountPath was not a mount point - we would have attempted to remove mountPath
|
||||||
|
// and hence return errors if any.
|
||||||
|
if err != nil || notMnt {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,8 +87,10 @@ func doCleanupMountPoint(mountPath string, mounter Interface, extensiveMountPoin
|
|||||||
var notMnt bool
|
var notMnt bool
|
||||||
var err error
|
var err error
|
||||||
if !corruptedMnt {
|
if !corruptedMnt {
|
||||||
_, err = removePathIfNotMountPoint(mountPath, mounter, extensiveMountPointCheck)
|
notMnt, err = removePathIfNotMountPoint(mountPath, mounter, extensiveMountPointCheck)
|
||||||
if err != nil {
|
// if mountPath was not a mount point - we would have attempted to remove mountPath
|
||||||
|
// and hence return errors if any.
|
||||||
|
if err != nil || notMnt {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user