Skip to content

Make MsgBlk allocation fallible#962

Open
FelixMcFelix wants to merge 5 commits intomasterfrom
fallible-mblk
Open

Make MsgBlk allocation fallible#962
FelixMcFelix wants to merge 5 commits intomasterfrom
fallible-mblk

Conversation

@FelixMcFelix
Copy link
Copy Markdown
Collaborator

@FelixMcFelix FelixMcFelix commented Apr 8, 2026

This PR makes the creation of new MsgBlks from allocb correctly handle the case where the system returns NULL. A bunch of downstream functions relied on creating new mblk_ts and have similarly been modified to return an error in this case. E.g., accessing a packet's body can require a pullup of the entire frame due to memory loaning from propolis, so the impact is a little wider than expected. We have some new KStats to explicitly show allocation failures, and it turns out we weren't tracking general classes of layer error before in our stats so that's remedied too since we're here.

The only places unwraps have been slotted in are throughout the test harness, since mblk allocation is infallible in std/test contexts.

Closes #840.

@FelixMcFelix FelixMcFelix marked this pull request as ready for review April 8, 2026 11:44
/// 77.try_into().unwrap(),
/// mcast_underlay,
/// Replication::External,
/// oxide_vpc::api::Replication::External,
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

cargo t was tripping up on illumos because of this doctest: no_run will still compile it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mblk_t creation is more fallible than expected

1 participant