From b57e146aec744a75c8f254896a0caf001ced479b Mon Sep 17 00:00:00 2001 From: Wei Fu Date: Fri, 6 Mar 2026 11:08:42 -0500 Subject: [PATCH] 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 (cherry picked from commit 2634261c175cf1c5960a808708728fb51df9f8ed) Signed-off-by: Wei Fu --- cmd/kubeadm/app/cmd/phases/reset/unmount_linux.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/kubeadm/app/cmd/phases/reset/unmount_linux.go b/cmd/kubeadm/app/cmd/phases/reset/unmount_linux.go index dc16209afbb..7cab7a64311 100644 --- a/cmd/kubeadm/app/cmd/phases/reset/unmount_linux.go +++ b/cmd/kubeadm/app/cmd/phases/reset/unmount_linux.go @@ -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])) } }