Skip to content

[release-4.13] fix: detect and remount stale NFS mounts in NodePublishVolume#1109

Merged
k8s-ci-robot merged 2 commits intokubernetes-csi:release-4.13from
k8s-infra-cherrypick-robot:cherry-pick-1108-to-release-4.13
Apr 19, 2026
Merged

[release-4.13] fix: detect and remount stale NFS mounts in NodePublishVolume#1109
k8s-ci-robot merged 2 commits intokubernetes-csi:release-4.13from
k8s-infra-cherrypick-robot:cherry-pick-1108-to-release-4.13

Conversation

@k8s-infra-cherrypick-robot
Copy link
Copy Markdown

This is an automated cherry-pick of #1108

/assign andyzhangx

Fix stale NFS mount detection in NodePublishVolume: pods with fsGroup can now recover after NFS server restart without manual intervention.

When an NFS server restarts, existing mounts become stale. If a pod
with fsGroup is restarted, kubelet calls applyFSGroup which does
lstat on the mount path and fails with ESTALE before CSI driver gets
a chance to remount.

Fix by checking for stale file handles when the target path is already
mounted. If detected, unmount the stale mount and proceed with a
fresh mount.

Ref 927
- Make os.Lstat injectable via lstatFunc package variable for testability
- Add NodePublishVolume test case covering ESTALE detection -> unmount -> remount
- Add TestIsStaleFileHandle with coverage for ESTALE errno, wrapped errors,
  string matching, and negative cases
@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Apr 19, 2026
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 19, 2026
Copy link
Copy Markdown
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 19, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx, k8s-infra-cherrypick-robot

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 19, 2026
@k8s-ci-robot k8s-ci-robot merged commit adec3ac into kubernetes-csi:release-4.13 Apr 19, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants