diff --git a/csi/controller_server.go b/csi/controller_server.go index 6c7fb7af08..af7b406917 100644 --- a/csi/controller_server.go +++ b/csi/controller_server.go @@ -551,8 +551,12 @@ func (cs *ControllerServer) ControllerUnpublishVolume(ctx context.Context, req * return cs.unpublishVolume(volume, nodeID, attachmentID, func() error { checkVolumeUnpublished := func(vol *longhornclient.Volume) bool { + isRegularRWXVolume := vol.AccessMode == string(longhorn.AccessModeReadWriteMany) && !vol.Migratable _, ok := vol.VolumeAttachment.Attachments[attachmentID] - return !ok + if isRegularRWXVolume { + return !ok + } + return !ok && !isVolumeAvailableOn(vol, nodeID) } if !cs.waitForVolumeState(volumeID, "volume unpublished", checkVolumeUnpublished, false, true) {