Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
fix(node): better checks on umount
Browse files Browse the repository at this point in the history
  • Loading branch information
plaffitt committed Apr 27, 2021
1 parent 2a5b8bf commit 34b65af
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,19 @@ func (node *Node) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublis
out, err := exec.Command("mountpoint", req.GetTargetPath()).CombinedOutput()
if err == nil {
out, err := exec.Command("umount", req.GetTargetPath()).CombinedOutput()
if err != nil && !os.IsNotExist(err) {
if err != nil {
return nil, status.Error(codes.Internal, string(out))
}
} else {
klog.Warningf("assuming that volume is already unmounted: %s", out)
}

os.Remove(req.GetTargetPath())
err = os.Remove(req.GetTargetPath())
if err != nil && !os.IsNotExist(err) {
return nil, status.Error(codes.Internal, err.Error())
}
} else {
klog.Warningf("assuming that volume is already unmounted: %v", err)
}

iscsiInfoPath := node.getIscsiInfoPath(req.GetVolumeId())
Expand Down

0 comments on commit 34b65af

Please sign in to comment.