mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 14:23:37 +00:00
Fix to reflect commnet
- Change not to skip error from GetLoopDevice other than DeviceNotFound - Add comment for the reason for order of descriptor lock release and TearDownDevice
This commit is contained in:
parent
3d808540df
commit
4226ae7a61
@ -1080,15 +1080,16 @@ func (og *operationGenerator) GenerateUnmapDeviceFunc(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The block volume is not referenced from Pods. Release file descriptor lock.
|
// The block volume is not referenced from Pods. Release file descriptor lock.
|
||||||
|
// This should be done before calling TearDownDevice, because some plugins that do local detach
|
||||||
|
// in TearDownDevice will fail in detaching device due to the refcnt on the loopback device.
|
||||||
glog.V(4).Infof("UnmapDevice: deviceToDetach.DevicePath: %v", deviceToDetach.DevicePath)
|
glog.V(4).Infof("UnmapDevice: deviceToDetach.DevicePath: %v", deviceToDetach.DevicePath)
|
||||||
loopPath, err := og.blkUtil.GetLoopDevice(deviceToDetach.DevicePath)
|
loopPath, err := og.blkUtil.GetLoopDevice(deviceToDetach.DevicePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err.Error() == volumepathhandler.ErrDeviceNotFound {
|
if err.Error() == volumepathhandler.ErrDeviceNotFound {
|
||||||
glog.Warningf(deviceToDetach.GenerateMsgDetailed("UnmapDevice: Couldn't find loopback device which takes file descriptor lock",
|
glog.Warningf(deviceToDetach.GenerateMsgDetailed("UnmapDevice: Couldn't find loopback device which takes file descriptor lock", fmt.Sprintf("device path: %q", deviceToDetach.DevicePath)))
|
||||||
fmt.Sprintf("device path: %q", deviceToDetach.DevicePath)))
|
|
||||||
} else {
|
} else {
|
||||||
glog.Warningf(deviceToDetach.GenerateMsgDetailed("UnmapDevice: GetLoopDevice failed to get loopback device",
|
errInfo := "UnmapDevice.GetLoopDevice failed to get loopback device, " + fmt.Sprintf("device path: %q", deviceToDetach.DevicePath)
|
||||||
fmt.Sprintf("device path: %q", deviceToDetach.DevicePath)))
|
return deviceToDetach.GenerateError(errInfo, err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if len(loopPath) != 0 {
|
if len(loopPath) != 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user