diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2022-08-20 15:03:00 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-20 15:03:00 -0700 |
| commit | 0ffb9c3778f118e3f6fdf9e7a55cd70096fefdac (patch) | |
| tree | a11ead292979216428228668e9308e22c02964a7 /pkg/driver/nodeserver.go | |
| parent | b4d5be34718fd4d49cc25ac8f49755b691c6a870 (diff) | |
| parent | 32031fee148673e5afdd97f47afb80721b56caf9 (diff) | |
| download | seaweedfs-csi-driver-0ffb9c3778f118e3f6fdf9e7a55cd70096fefdac.tar.xz seaweedfs-csi-driver-0ffb9c3778f118e3f6fdf9e7a55cd70096fefdac.zip | |
Merge pull request #80 from kvaster/cleanup-mount-points
Make sure mount points are cleaned up
Diffstat (limited to 'pkg/driver/nodeserver.go')
| -rw-r--r-- | pkg/driver/nodeserver.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/driver/nodeserver.go b/pkg/driver/nodeserver.go index 7d9bfc1..38ba34f 100644 --- a/pkg/driver/nodeserver.go +++ b/pkg/driver/nodeserver.go @@ -139,6 +139,11 @@ func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu volume, ok := ns.volumes.Load(volumeID) if !ok { glog.Warningf("volume %s hasn't been published", volumeID) + + // make sure there is no any garbage + mounter := mount.New("") + _ = mount.CleanupMountPoint(targetPath, mounter, true) + return &csi.NodeUnpublishVolumeResponse{}, nil } @@ -206,6 +211,11 @@ func (ns *NodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstag volume, ok := ns.volumes.Load(volumeID) if !ok { glog.Warningf("volume %s hasn't been staged", volumeID) + + // make sure there is no any garbage + mounter := mount.New("") + _ = mount.CleanupMountPoint(stagingTargetPath, mounter, true) + return &csi.NodeUnstageVolumeResponse{}, nil } |
