blockdev: Fix loopback device resource leak on signal interruption#1402
blockdev: Fix loopback device resource leak on signal interruption#1402gursewak1997 merged 1 commit intobootc-dev:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a signal-safe cleanup mechanism for loopback devices to prevent resource leaks on signal interruption. It uses an out-of-process helper to clean up leaked loopback devices. I've added comments to enhance error logging for better debugging.
70c2b77 to
a4ab303
Compare
|
Thanks for working on this! While it will be a bit more awkward can you try doing it this way #799 (comment) - that should 100% avoid all the unsafe code. Basically instead of a raw |
cgwalters
left a comment
There was a problem hiding this comment.
Thanks! Looking closer
cgwalters
left a comment
There was a problem hiding this comment.
Thanks, looking a lot closer!
507ad56 to
f0de48a
Compare
|
This is looking pretty good to me now! Is there a reason it's still in draft? Can you also mark issues in the discussion as resolved when they're fixed? |
Every issue in discussion should be fixed now. |
cgwalters
left a comment
There was a problem hiding this comment.
LGTM aside from one last bit
Add fork+exec based cleanup helper to prevent loopback device leaks when bootc install --via-loopback is interrupted by signals like SIGINT. - Add loopback-cleanup-helper CLI subcommand - Implement run_loopback_cleanup_helper() with PR_SET_PDEATHSIG - Update LoopbackDevice to spawn cleanup helper process - Add tests for spawn mechanism
|
Fallout in #1439 |
This commit implements issue #799 by creating a signal-safe cleanup helper for loopback devices to prevent resource leaks when bootc install --via-loopback is interrupted by signals like SIGINT (Ctrl-C).
The solution uses an 'out-of-process drop' helper that:
This prevents the common issue where interrupting bootc install --via-loopback with Ctrl-C would leave /dev/loopN devices allocated on the system.
Fixes: #799