util: do not use mount-utils.IsLikelyNotMountPoint anymore

`IsLikelyNotMountPoint()` is an optimized version for `IsMountPoint()`
which can not detect all type of mounts (anymore). The slower
`IsMountPoint()` is more safe to use. This can cause a slight
performance regression in the case there are many mountpoints on the
system, but correctness is more important than speed while mounting.

Fixes: #4633
Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos
2025-03-07 17:09:40 +01:00
committed by mergify[bot]
parent 76b4f53897
commit 79cf0321dd
23 changed files with 599 additions and 112 deletions

View File

@ -47,7 +47,7 @@ func (ms mountState) String() string {
}
func (ns *NodeServer) getMountState(path string) (mountState, error) {
isMnt, err := util.IsMountPoint(ns.Mounter, path)
isMnt, err := ns.Mounter.IsMountPoint(path)
if err != nil {
if util.IsCorruptedMountError(err) {
return msCorrupted, nil

View File

@ -263,7 +263,7 @@ func (ns *NodeServer) NodeStageVolume(
}
}
isMnt, err := util.IsMountPoint(ns.Mounter, stagingTargetPath)
isMnt, err := ns.Mounter.IsMountPoint(stagingTargetPath)
if err != nil {
log.ErrorLog(ctx, "stat failed: %v", err)
@ -539,7 +539,7 @@ func (ns *NodeServer) NodePublishVolume(
// Ensure staging target path is a mountpoint.
isMnt, err := util.IsMountPoint(ns.Mounter, stagingTargetPath)
isMnt, err := ns.Mounter.IsMountPoint(stagingTargetPath)
if err != nil {
log.ErrorLog(ctx, "stat failed: %v", err)
@ -552,7 +552,7 @@ func (ns *NodeServer) NodePublishVolume(
// Check if the volume is already mounted
isMnt, err = util.IsMountPoint(ns.Mounter, targetPath)
isMnt, err = ns.Mounter.IsMountPoint(targetPath)
if err != nil {
log.ErrorLog(ctx, "stat failed: %v", err)
@ -615,7 +615,7 @@ func (ns *NodeServer) NodeUnpublishVolume(
// stop the health-checker that may have been started in NodeGetVolumeStats()
ns.healthChecker.StopChecker(volID, targetPath)
isMnt, err := util.IsMountPoint(ns.Mounter, targetPath)
isMnt, err := ns.Mounter.IsMountPoint(targetPath)
if err != nil {
log.ErrorLog(ctx, "stat failed: %v", err)
@ -687,7 +687,7 @@ func (ns *NodeServer) NodeUnstageVolume(
return nil, status.Error(codes.Internal, err.Error())
}
isMnt, err := util.IsMountPoint(ns.Mounter, stagingTargetPath)
isMnt, err := ns.Mounter.IsMountPoint(stagingTargetPath)
if err != nil {
log.ErrorLog(ctx, "stat failed: %v", err)