Skip to content

Commit

Permalink
check if the mount point directory exists in unpublish
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Richerson <[email protected]>
  • Loading branch information
matthew-richerson committed Oct 25, 2023
1 parent 4d9b845 commit 372569e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/lustre-driver/service/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ func (s *service) NodeUnpublishVolume(
return nil, status.Errorf(codes.InvalidArgument, "NodeUnpublishVolume - TargetPath is required")
}

// If the target path does not exist, consider it unmounted
if _, err := os.Stat(req.GetTargetPath()); os.IsNotExist(err) {
return &csi.NodeUnpublishVolumeResponse{}, nil
}

mounter := mount.New("")
notMountPoint, err := mount.IsNotMountPoint(mounter, req.GetTargetPath())
if err != nil {
Expand Down

0 comments on commit 372569e

Please sign in to comment.