Skip to content

Commit 6ae563a

Browse files
andyzhangxk8s-infra-cherrypick-robot
authored andcommitted
fix: fix nfs mount stuck issue
1 parent a6507a0 commit 6ae563a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pkg/blob/nodeserver.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import (
3232

3333
"github.com/container-storage-interface/spec/lib/go/csi"
3434

35-
"k8s.io/apimachinery/pkg/util/wait"
3635
"k8s.io/klog/v2"
3736
"k8s.io/kubernetes/pkg/volume"
3837
"k8s.io/kubernetes/pkg/volume/util"
@@ -352,9 +351,9 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
352351

353352
source := fmt.Sprintf("%s:/%s/%s", serverAddress, accountName, containerName)
354353
mountOptions := util.JoinMountOptions(mountFlags, []string{"sec=sys,vers=3,nolock"})
355-
if err := wait.PollImmediate(1*time.Second, 2*time.Minute, func() (bool, error) {
356-
return true, d.mounter.MountSensitive(source, targetPath, mountType, mountOptions, []string{})
357-
}); err != nil {
354+
execFunc := func() error { return d.mounter.MountSensitive(source, targetPath, mountType, mountOptions, []string{}) }
355+
timeoutFunc := func() error { return fmt.Errorf("time out") }
356+
if err := volumehelper.WaitForExecCompletion(2*time.Minute, execFunc, timeoutFunc); err != nil {
358357
var helpLinkMsg string
359358
if d.appendMountErrorHelpLink {
360359
helpLinkMsg = "\nPlease refer to http://aka.ms/blobmounterror for possible causes and solutions for mount errors."

0 commit comments

Comments
 (0)