mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 02:06:23 +00:00
cmd/kubeadm: ignore EINVAL error during unmount
If /var/lib/kubelet is MS_SHARED mountpoint, all the mountpoints
under /var/lib/kubelet will have duplicate one. When `kubeadm reset -f`
is executed, it will try to umount one path twice. However, they are in
the peer group. Once we umount one path, the duplicate one will be
umounted as well. So, in this case, we should ignore EINVAL error.
Signed-off-by: Wei Fu <fuweid89@gmail.com>
(cherry picked from commit 2634261c17)
Signed-off-by: Wei Fu <fuweid89@gmail.com>
This commit is contained in:
@@ -70,6 +70,12 @@ func unmountKubeletDirectory(kubeletRunDirectory string, flags []string) error {
|
||||
}
|
||||
klog.V(5).Infof("[reset] Unmounting %q", m[1])
|
||||
if err := syscall.Unmount(m[1], flagsInt); err != nil {
|
||||
// EINVAL is expected here if a duplicate mount entry
|
||||
// was already unmounted via its shared peer.
|
||||
if err == syscall.EINVAL {
|
||||
klog.Warningf("[reset] Ignoring EINVAL error while unmounting %q", m[1])
|
||||
continue
|
||||
}
|
||||
errList = append(errList, errors.WithMessagef(err, "failed to unmount %q", m[1]))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user