mirror of https://github.com/k3s-io/k3s
Merge pull request #51361 from yastij/iscsi-handle-failedMount
Automatic merge from submit-queue (batch tested with PRs 51439, 51361, 51140, 51539, 51585) Iscsi handle failed mount **What this PR does / why we need it**: **Which issue this PR fixes**: fixes #50556 **Special notes for your reviewer**: **Release note**: ```release-note None ```pull/6/head
commit
5f8d229585
|
@ -62,7 +62,29 @@ func diskSetUp(manager diskManager, b iscsiDiskMounter, volPath string, mounter
|
|||
mountOptions := volume.JoinMountOptions(b.mountOptions, options)
|
||||
err = mounter.Mount(globalPDPath, volPath, "", mountOptions)
|
||||
if err != nil {
|
||||
glog.Errorf("failed to bind mount:%s", globalPDPath)
|
||||
glog.Errorf("Failed to bind mount: source:%s, target:%s, err:%v", globalPDPath, volPath, err)
|
||||
noMnt, mntErr := b.mounter.IsLikelyNotMountPoint(volPath)
|
||||
if mntErr != nil {
|
||||
glog.Errorf("IsLikelyNotMountPoint check failed: %v", mntErr)
|
||||
return err
|
||||
}
|
||||
if !noMnt {
|
||||
if mntErr = b.mounter.Unmount(volPath); mntErr != nil {
|
||||
glog.Errorf("Failed to unmount: %v", mntErr)
|
||||
return err
|
||||
}
|
||||
noMnt, mntErr = b.mounter.IsLikelyNotMountPoint(volPath)
|
||||
if mntErr != nil {
|
||||
glog.Errorf("IsLikelyNotMountPoint check failed: %v", mntErr)
|
||||
return err
|
||||
}
|
||||
if !noMnt {
|
||||
// will most likely retry on next sync loop.
|
||||
glog.Errorf("%s is still mounted, despite call to unmount(). Will try again next sync loop.", volPath)
|
||||
return err
|
||||
}
|
||||
}
|
||||
os.Remove(volPath)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue