From 32031fee148673e5afdd97f47afb80721b56caf9 Mon Sep 17 00:00:00 2001 From: Viktor Kuzmin Date: Sat, 20 Aug 2022 23:54:24 +0300 Subject: Make sure mount point is cleaned up even if we think we're not managing it --- pkg/driver/nodeserver.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'pkg/driver/nodeserver.go') 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 } -- cgit v1.2.3