Skip to content

kubevirt-csi node: NFS publish hangs on the temp mount when the NFS server stops answering #4581

Open

Description

The kubevirt-csi node plugin can hang an NFS volume publish if the NFS server stops answering while the plugin works on its temporary mount.

To create /data, NodePublishVolume in packages/apps/kubernetes/images/kubevirt-csi-driver/node.go mounts the export root into an nfs-init-* temp dir. The mount options are only nfsvers=4.2 and port=, so it is a hard mount. After that the plugin calls os.MkdirAll, os.ReadDir and os.Rename on it. None of these calls has a deadline on a hard mount, and neither does the Mount before them. If the server goes away at that point, the handler goroutine blocks.

Kubelet gives up after its 2m CSI deadline (csiTimeout in pkg/volume/csi/csi_plugin.go) and retries the call. The blocked goroutine stays. Each retry creates another temp dir and blocks the same way. Stuck goroutines and nfs-init-* dirs pile up until the server comes back or the container restarts.

The PR for #4561 bounds the unmount at the end of this path. It does not help with the calls before it. I see two ways to fix this: mount the temp root with soft and a bounded timeo/retrans, since it only does metadata work, or refuse a new publish for a volume that already has one in progress.

Activity

  1. lexfrei commented on Oct 5, 2026

    @lexfrei
    ContributorAuthor

    Two more things in the same area are left after #4584. Both are bounded by its 30s unmount budget, so neither hangs the publish, but both pile up per retry the same way as the calls above.

    First, when the plain umount hits its timeout, only umount gets SIGKILL. The umount.nfs helper it forked stays behind, stuck in umount2() on the dead server, and the plugin goroutine waiting on the unmount stays too, one of each per publish that timed out. mount-utils' UnmountWithForce leaves the same orphan. I saw the orphan with a fake umount that forks a child, not on a real dead server.

    Second, I have not verified this one. util-linux umount, or the umount.nfs helper, may stat the target before it calls umount2(MNT_FORCE). On a hard mount with the server gone that stat blocks, so umount -f would hang before it does anything and only the timeout would end it. To check: on almalinux:9 with nfs-utils, mount an export without soft, drop the server (for example with an iptables DROP rule on port 2049), run strace -f umount -f <dir> and see whether it reaches umount2 or blocks in stat/statx first. If it blocks there, umount -c (no canonicalize) may get past it.

    The soft mount with a bounded timeo/retrans suggested above would likely cover both, since RPCs on the temp mount would then fail instead of blocking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/kubernetesIssues or PRs related to the tenant Kubernetes appkind/bugCategorizes issue or PR as related to a bugtriage/needs-triageIndicates an issue needs triage by a maintainer

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions