Mark device as uncertain if unmount device succeeds

If unmount device succeeds but somehow unmount operation
fails because device was in-use elsewhere, we should mark the
device mount as uncertain because we can't use the global
mount point at this point.
This commit is contained in:
Hemant Kumar 2022-01-26 07:49:49 -05:00
parent 25697c4812
commit ff765210d5

View File

@ -1015,6 +1015,12 @@ func (og *operationGenerator) GenerateUnmountDeviceFunc(
} }
// The device is still in use elsewhere. Caller will log and retry. // The device is still in use elsewhere. Caller will log and retry.
if deviceOpened { if deviceOpened {
// Mark the device as uncertain, so MountDevice is called for new pods.
markDeviceUncertainErr := actualStateOfWorld.MarkDeviceAsUncertain(deviceToDetach.VolumeName, deviceToDetach.DevicePath, deviceMountPath)
if markDeviceUncertainErr != nil {
// There is nothing else we can do. Hope that UnmountDevice will be re-tried shortly.
klog.Errorf(deviceToDetach.GenerateErrorDetailed("UnmountDevice.MarkDeviceAsUncertain failed", markDeviceUncertainErr).Error())
}
eventErr, detailedErr := deviceToDetach.GenerateError( eventErr, detailedErr := deviceToDetach.GenerateError(
"UnmountDevice failed", "UnmountDevice failed",
goerrors.New("the device is in use when it was no longer expected to be in use")) goerrors.New("the device is in use when it was no longer expected to be in use"))