Skip to content

Commit fa2dd7a

Browse files
authored
Merge pull request #277 from andyzhangx/unmount-stuck
fix: unmount stuck issue when smb file share is not found
2 parents 1795ebd + 010ade8 commit fa2dd7a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pkg/smb/nodeserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func (d *Driver) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublish
127127
}
128128

129129
klog.V(2).Infof("NodeUnpublishVolume: unmounting volume %s on %s", volumeID, targetPath)
130-
err := CleanupMountPoint(d.mounter, targetPath, false)
130+
err := CleanupSMBMountPoint(d.mounter, targetPath, false)
131131
if err != nil {
132132
return nil, status.Errorf(codes.Internal, "failed to unmount target %q: %v", targetPath, err)
133133
}

pkg/smb/smb_common_linux.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ func RemoveStageTarget(m *mount.SafeFormatAndMount, target string) error {
3737
}
3838

3939
func CleanupSMBMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error {
40+
// unmount first since if remote SMB directory is not found, linked path cannot be deleted with CleanupMountPoint
41+
// https://github.com/kubernetes/kubernetes/issues/97031
42+
_ = m.Unmount(target)
4043
return mount.CleanupMountPoint(target, m, extensiveMountCheck)
4144
}
4245

0 commit comments

Comments
 (0)