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

Syncing latest changes from upstream devel for ceph-csi #389

Merged
merged 5 commits into from
Sep 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
rbd: prevent re-use of destroyed resources
When an `.Destroy()` is called on an rbdImage (or rbdVolume or
rbdSnapshot), the IOContext, Connection and other attributes are
invalid. When using a destroyed resource that points to an object that
was allocated through librbd, the process most likely ends with a panic.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
  • Loading branch information
nixpanic authored and mergify[bot] committed Sep 26, 2024
commit 8c252d58eacd04fe2d43e59c451abcf71882d87b
4 changes: 4 additions & 0 deletions internal/rbd/rbd_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,19 @@ func (ri *rbdImage) Connect(cr *util.Credentials) error {
func (ri *rbdImage) Destroy(ctx context.Context) {
if ri.ioctx != nil {
ri.ioctx.Destroy()
ri.ioctx = nil
}
if ri.conn != nil {
ri.conn.Destroy()
ri.conn = nil
}
if ri.isBlockEncrypted() {
ri.blockEncryption.Destroy()
ri.blockEncryption = nil
}
if ri.isFileEncrypted() {
ri.fileEncryption.Destroy()
ri.fileEncryption = nil
}
}

Expand Down