nvme_driver: harden error handling in restore path
@gurasinghMS is already working on this.
Since Apr 8, 2026.
- Dominant language
- Rust
- Stars
- 1.9k
- Forks
- 238
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 100
Description
Pre-existing error handling gaps in NvmeDriver::restore() identified during review of #3220. None are regressions — they existed before the eager/lazy restore split.
Items
-
flat_mapsilently drops queue restore failures — The restore loop usesflat_mapwith aResult-returning closure. BecauseResultimplementsIntoIterator,Errvalues are silently dropped. A queue that fails to restore (e.g., interrupt mapping failure) is quietly omitted with no diagnostic. Should usemap+collect::<Result<Vec<_>, _>>()?to propagate errors. -
expect("unable to find restored mem block")panics on mismatch — If saved state doesn't match the restored DMA allocations (corrupt state, version skew), this panics instead of returning a structured error. Should use.ok_or_else(|| anyhow!(...))?. -
per_cpu[q.cpu as usize].set().unwrap()panics on invalid CPU — No bounds check before indexing, and.unwrap()on.set()panics if the slot is already occupied (duplicate CPU in saved state). Should validateq.cpu < cpu_countand handle duplicates with an error return.
Also tracked by Microsoft-internal ADO 61766158
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.