mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +00:00
add remount logic if original mount path is invalid
This commit is contained in:
parent
9f80ae7410
commit
1bfb5d0670
@ -232,6 +232,19 @@ func (attacher *azureDiskAttacher) MountDevice(spec *volume.Spec, devicePath str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !notMnt {
|
||||||
|
// testing original mount point, make sure the mount link is valid
|
||||||
|
if _, err := (&osIOHandler{}).ReadDir(deviceMountPath); err != nil {
|
||||||
|
// mount link is invalid, now unmount and remount later
|
||||||
|
glog.Warningf("azureDisk - ReadDir %s failed with %v, unmount this directory", deviceMountPath, err)
|
||||||
|
if err := mounter.Unmount(deviceMountPath); err != nil {
|
||||||
|
glog.Errorf("azureDisk - Unmount deviceMountPath %s failed with %v", deviceMountPath, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
notMnt = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
volumeSource, err := getVolumeSource(spec)
|
volumeSource, err := getVolumeSource(spec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -86,8 +86,19 @@ func (m *azureDiskMounter) SetUpAt(dir string, fsGroup *int64) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !mountPoint {
|
if !mountPoint {
|
||||||
glog.V(4).Infof("azureDisk - already mounted to target %s", dir)
|
// testing original mount point, make sure the mount link is valid
|
||||||
return nil
|
_, err := (&osIOHandler{}).ReadDir(dir)
|
||||||
|
if err == nil {
|
||||||
|
glog.V(4).Infof("azureDisk - already mounted to target %s", dir)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
// mount link is invalid, now unmount and remount later
|
||||||
|
glog.Warningf("azureDisk - ReadDir %s failed with %v, unmount this directory", dir, err)
|
||||||
|
if err := mounter.Unmount(dir); err != nil {
|
||||||
|
glog.Errorf("azureDisk - Unmount directory %s failed with %v", dir, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
mountPoint = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if runtime.GOOS != "windows" {
|
if runtime.GOOS != "windows" {
|
||||||
|
Loading…
Reference in New Issue
Block a user