diff --git a/internal/cephfs/fuserecovery.go b/internal/cephfs/fuserecovery.go index 41f60aa2a31..398a97cefa6 100644 --- a/internal/cephfs/fuserecovery.go +++ b/internal/cephfs/fuserecovery.go @@ -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 diff --git a/internal/cephfs/nodeserver.go b/internal/cephfs/nodeserver.go index ea26af1aa36..28bfa4b8b34 100644 --- a/internal/cephfs/nodeserver.go +++ b/internal/cephfs/nodeserver.go @@ -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) @@ -616,7 +616,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) @@ -688,7 +688,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) diff --git a/internal/csi-common/utils.go b/internal/csi-common/utils.go index b541e68f6f4..e9ac2ce6963 100644 --- a/internal/csi-common/utils.go +++ b/internal/csi-common/utils.go @@ -25,7 +25,6 @@ import ( "sync/atomic" "time" - "github.com/ceph/ceph-csi/internal/util" "github.com/ceph/ceph-csi/internal/util/log" "github.com/container-storage-interface/spec/lib/go/csi" @@ -351,7 +350,7 @@ func FilesystemNodeGetVolumeStats( targetPath string, includeInodes bool, ) (*csi.NodeGetVolumeStatsResponse, error) { - isMnt, err := util.IsMountPoint(mounter, targetPath) + isMnt, err := mounter.IsMountPoint(targetPath) if err != nil { if os.IsNotExist(err) { return nil, status.Errorf(codes.InvalidArgument, "targetpath %s does not exist", targetPath) diff --git a/internal/util/util.go b/internal/util/util.go index 1d62c650223..682e430c4fc 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -327,16 +327,6 @@ func checkDirExists(p string) bool { return true } -// IsMountPoint checks if the given path is mountpoint or not. -func IsMountPoint(mounter mount.Interface, p string) (bool, error) { - notMnt, err := mounter.IsLikelyNotMountPoint(p) - if err != nil { - return false, err - } - - return !notMnt, nil -} - // IsCorruptedMountError checks if the given error is a result of a corrupted // mountpoint. func IsCorruptedMountError(err error) bool {