kvm: extract RBD handle teardown into null-safe helper methods - #4
Merged
calvix merged 1 commit intoAug 11, 2026
Conversation
Address review feedback: the nested try-catch teardown blocks in the finally clauses of takeRbdVolumeSnapshotOfStoppedVm and createRBDvolumeFromRBDSnapshot are extracted into two reusable, null-safe helpers that log but never throw: - closeRbdImage (3 call sites) - destroyRadosIoCtx (2 call sites) No behavior change.
calvix
force-pushed
the
fix/rbd-snapshot-exclusive-lock-leak-refactor
branch
from
August 11, 2026 07:08
71efc11 to
f4ddf95
Compare
calvix
merged commit Aug 11, 2026
f3ff36d
into
fix/rbd-snapshot-exclusive-lock-leak
13 of 14 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the review comment on the RBD exclusive-lock fix:
The inline nested try-catch teardown blocks in the
finallyclauses oftakeRbdVolumeSnapshotOfStoppedVmandcreateRBDvolumeFromRBDSnapshotare extracted into two reusable, null-safe helpers that log but never throw (the never-throws contract is documented in the javadoc, making them safe to call fromfinallyblocks; naming follows the codebase's plain-verb helper style, e.g.closeChannel,cleanupVMNetworks,destroyStoragePool):closeRbdImage— 3 call sitesdestroyRadosIoCtx— 2 call sitesThe
snapUnprotectblock stays inline: it is not a close, occurs once, and logs at ERROR severity.Deliberately out of scope, to keep the lock fix minimal and backportable:
deleteSnapshot's bare non-null-safe finally — pre-existing since 2015 (10ae2af) with its own additional leak path (ioleaks ifrbd.openthrows); candidate for a follow-up where these helpers make it a 3-line changecreateRBDvolumeFromRBDSnapshotwithradosConnectNo behavior change. All 39 tests in
KVMStorageProcessorTestpass, including the two regression tests verifyingclose/ioCtxDestroyare invoked on the failure path.