@@ -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"
@@ -66,7 +67,7 @@ func (ns *GCENodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePub
66
67
return nil , status .Error (codes .InvalidArgument , "NodePublishVolume Volume Capability must be provided" )
67
68
}
68
69
69
- notMnt , err := ns .Mounter .Interface .IsLikelyNotMountPoint (targetPath )
70
+ notMnt , err := ns .Mounter .Interface .IsNotMountPoint (targetPath )
70
71
if err != nil && ! os .IsNotExist (err ) {
71
72
glog .Errorf ("cannot validate mount point: %s %v" , targetPath , err )
72
73
return nil , err
@@ -133,9 +134,7 @@ func (ns *GCENodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeU
133
134
return nil , status .Error (codes .InvalidArgument , "NodeUnpublishVolume Target Path must be provided" )
134
135
}
135
136
136
- // TODO(#96): Check volume still exists
137
-
138
- err := ns .Mounter .Interface .Unmount (targetPath )
137
+ err := volumeutils .UnmountMountPoint (targetPath , ns .Mounter .Interface , true /* bind mount */ )
139
138
if err != nil {
140
139
return nil , status .Error (codes .Internal , fmt .Sprintf ("Unmount failed: %v\n Unmounting arguments: %s\n " , err , targetPath ))
141
140
}
@@ -242,7 +241,7 @@ func (ns *GCENodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUns
242
241
return nil , status .Error (codes .InvalidArgument , "NodeUnstageVolume Staging Target Path must be provided" )
243
242
}
244
243
245
- err := ns .Mounter .Interface . Unmount ( stagingTargetPath )
244
+ err := volumeutils . UnmountMountPoint ( stagingTargetPath , ns .Mounter .Interface , false /* bind mount */ )
246
245
if err != nil {
247
246
return nil , status .Error (codes .Internal , fmt .Sprintf ("NodeUnstageVolume failed to unmount at path %s: %v" , stagingTargetPath , err ))
248
247
}
0 commit comments