Skip to content

Commit d04668d

Browse files
committed
fix(csi): correct CleanupMountPoint comment semantics
Signed-off-by: mrhapile <[email protected]>
1 parent 024c571 commit d04668d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pkg/csi/recover/recover.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,16 +240,19 @@ func (r *FuseRecover) lazyUnmountIfNeeded(mountPath string) {
240240
// FUSE restart leaves stale mounts. Normal unmount may fail or block.
241241
// Lazy unmount prevents stack piling and cleans up /dev/fuse references.
242242

243-
mounter := mount.New("")
244-
245-
// Use CleanupMountPoint which handles corrupted mounts and lazy unmount (force=true).
246-
if err := mount.CleanupMountPoint(mountPath, mounter, true); err != nil {
243+
// Use CleanupMountPoint with extensiveMountPointCheck=true, which relies on
244+
// IsNotMountPoint instead of IsLikelyNotMountPoint and properly handles
245+
// bind mounts and corrupted mount points during cleanup.
246+
if err := mount.CleanupMountPoint(mountPath, r.Interface, true); err != nil {
247247
glog.Warningf("FuseRecovery: failed to cleanup mount %s: %v", mountPath, err)
248248
}
249249

250250
// Wait briefly until the mount is released by the kernel.
251251
err := wait.Poll(500*time.Millisecond, 2*time.Second, func() (bool, error) {
252-
notMnt, err := mounter.IsLikelyNotMountPoint(mountPath)
252+
notMnt, err := r.Interface.IsLikelyNotMountPoint(mountPath)
253+
if os.IsNotExist(err) {
254+
return true, nil
255+
}
253256
return err == nil && notMnt, nil
254257
})
255258
if err != nil {

0 commit comments

Comments
 (0)