@@ -130,24 +130,13 @@ func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
130130 if len (targetPath ) == 0 {
131131 return nil , status .Error (codes .InvalidArgument , "Target path missing in request" )
132132 }
133- notMnt , err := ns .mounter .IsLikelyNotMountPoint (targetPath )
134133
134+ klog .V (2 ).Infof ("NodeUnpublishVolume: unmounting volume %s on %s" , volumeID , targetPath )
135+ err := mount .CleanupMountPoint (targetPath , ns .mounter , true /*extensiveMountPointCheck*/ )
135136 if err != nil {
136- if os .IsNotExist (err ) {
137- return nil , status .Error (codes .NotFound , "Targetpath not found" )
138- }
139- return nil , status .Error (codes .Internal , err .Error ())
140- }
141- if notMnt {
142- klog .V (2 ).Infof ("NodeUnpublishVolume: Targetpath %s of volumeID(%s) is not mounted" , targetPath , volumeID )
143- return & csi.NodeUnpublishVolumeResponse {}, nil
144- }
145-
146- klog .V (2 ).Infof ("NodeUnpublishVolume: CleanupMountPoint %s on volumeID(%s)" , targetPath , volumeID )
147- err = mount .CleanupMountPoint (targetPath , ns .mounter , false )
148- if err != nil {
149- return nil , status .Error (codes .Internal , err .Error ())
137+ return nil , status .Errorf (codes .Internal , "failed to unmount target %q: %v" , targetPath , err )
150138 }
139+ klog .V (2 ).Infof ("NodeUnpublishVolume: unmount volume %s on %s successfully" , volumeID , targetPath )
151140
152141 return & csi.NodeUnpublishVolumeResponse {}, nil
153142}
0 commit comments