From 13f03ac2c4d8872979caa8e9b7cedac20979919b Mon Sep 17 00:00:00 2001 From: Beorn Facchini Date: Thu, 13 Jun 2024 04:13:28 +1000 Subject: [PATCH] CSI node plugin fix for unstaging volumes Signed-off-by: Beorn Facchini --- agent/csi/plugin/plugin.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/agent/csi/plugin/plugin.go b/agent/csi/plugin/plugin.go index a721ac25a..90e4d8bc2 100644 --- a/agent/csi/plugin/plugin.go +++ b/agent/csi/plugin/plugin.go @@ -263,11 +263,8 @@ func (np *nodePlugin) NodeUnstageVolume(ctx context.Context, req *api.VolumeAssi // we must unpublish before we unstage. verify here that the volume is not // published. - if v, ok := np.volumeMap[req.ID]; ok { - if v.isPublished { - return status.Errorf(codes.FailedPrecondition, "Volume %s is not unpublished", req.ID) - } - return nil + if v, ok := np.volumeMap[req.ID]; ok && v.isPublished { + return status.Errorf(codes.FailedPrecondition, "Volume %s is not unpublished", req.ID) } _, err = c.NodeUnstageVolume(ctx, &csi.NodeUnstageVolumeRequest{