Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csi: prevent panic on volume delete #18234

Merged
merged 2 commits into from
Aug 17, 2023
Merged

csi: prevent panic on volume delete #18234

merged 2 commits into from
Aug 17, 2023

Conversation

lgfa29
Copy link
Contributor

@lgfa29 lgfa29 commented Aug 17, 2023

When a CSI volume is deleted when its plugin is not running, the function volAndPluginLookup returns a nil plugin value resulting a panic in the request handler.

Note to reviewers: the other place where volAndPluginLookup is used already checks for a nil plugin.

nomad/nomad/csi_endpoint.go

Lines 513 to 518 in e21ab7d

// Some plugins support controllers for create/snapshot but not attach. So
// if there's no plugin or the plugin doesn't attach volumes, then we can
// skip the controller publish workflow and return nil.
if plug == nil || !plug.HasControllerCapability(structs.CSIControllerSupportsAttachDetach) {
return nil
}

When a CSI volume is deleted when its plugin is not running, the
function `volAndPluginLookup` returns a `nil` plugin value resulting a
panic in the request handler.
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lgfa29 lgfa29 merged commit bff5ef7 into main Aug 17, 2023
30 of 31 checks passed
@lgfa29 lgfa29 deleted the b-fix-csi-panic branch August 17, 2023 13:47
@lgfa29 lgfa29 added backport/1.5.x backport to 1.5.x release line backport/1.6.x backport to 1.6.x release line and removed backport/1.5.x backport to 1.5.x release line backport/1.6.x backport to 1.6.x release line labels Aug 17, 2023
lgfa29 added a commit that referenced this pull request Aug 17, 2023
When a CSI volume is deleted while its plugin is not running, the
function `volAndPluginLookup` returns a `nil` plugin value resulting in a
panic in the request handler.
lgfa29 added a commit that referenced this pull request Aug 17, 2023
When a CSI volume is deleted while its plugin is not running, the
function `volAndPluginLookup` returns a `nil` plugin value resulting in a
panic in the request handler.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.4.x backport to 1.4.x release line backport/1.5.x backport to 1.5.x release line backport/1.6.x backport to 1.6.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants