From ff765210d5808df2392c0500f4061e84b3a94ec3 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Wed, 26 Jan 2022 07:49:49 -0500 Subject: [PATCH] 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. --- pkg/volume/util/operationexecutor/operation_generator.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/volume/util/operationexecutor/operation_generator.go b/pkg/volume/util/operationexecutor/operation_generator.go index 47603d6ad89..3adcc7521aa 100644 --- a/pkg/volume/util/operationexecutor/operation_generator.go +++ b/pkg/volume/util/operationexecutor/operation_generator.go @@ -1015,6 +1015,12 @@ func (og *operationGenerator) GenerateUnmountDeviceFunc( } // The device is still in use elsewhere. Caller will log and retry. 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( "UnmountDevice failed", goerrors.New("the device is in use when it was no longer expected to be in use"))