@@ -26,6 +26,7 @@ import (
26
26
"google.golang.org/grpc/codes"
27
27
"google.golang.org/grpc/status"
28
28
"k8s.io/kubernetes/pkg/util/mount"
29
+ volumeutils "k8s.io/kubernetes/pkg/volume/util"
29
30
"sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/common"
30
31
metadataservice "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/gce-cloud-provider/metadata"
31
32
mountmanager "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/mount-manager"
@@ -139,9 +140,7 @@ func (ns *GCENodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeU
139
140
return nil , status .Error (codes .InvalidArgument , "NodeUnpublishVolume Target Path must be provided" )
140
141
}
141
142
142
- // TODO(#96): Check volume still exists
143
-
144
- err := ns .Mounter .Interface .Unmount (targetPath )
143
+ err := volumeutils .UnmountMountPoint (targetPath , ns .Mounter .Interface , false /* bind mount */ )
145
144
if err != nil {
146
145
return nil , status .Error (codes .Internal , fmt .Sprintf ("Unmount failed: %v\n Unmounting arguments: %s\n " , err , targetPath ))
147
146
}
@@ -259,7 +258,7 @@ func (ns *GCENodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUns
259
258
return nil , status .Error (codes .InvalidArgument , "NodeUnstageVolume Staging Target Path must be provided" )
260
259
}
261
260
262
- err := ns .Mounter .Interface . Unmount ( stagingTargetPath )
261
+ err := volumeutils . UnmountMountPoint ( stagingTargetPath , ns .Mounter .Interface , false /* bind mount */ )
263
262
if err != nil {
264
263
return nil , status .Error (codes .Internal , fmt .Sprintf ("NodeUnstageVolume failed to unmount at path %s: %v" , stagingTargetPath , err ))
265
264
}
0 commit comments