diff --git a/drivers/graphics/vesad/src/main.rs b/drivers/graphics/vesad/src/main.rs index a4c07d1ee5..968abe594d 100644 --- a/drivers/graphics/vesad/src/main.rs +++ b/drivers/graphics/vesad/src/main.rs @@ -129,5 +129,8 @@ fn daemon(daemon: daemon::Daemon) -> ! { } } - panic!(); + // Event sources exhausted — exit cleanly so init can decide whether + // to restart vesad or fall back to a different display driver. + eprintln!("vesad: event sources exhausted, exiting"); + std::process::exit(0); } diff --git a/drivers/storage/nvmed/src/main.rs b/drivers/storage/nvmed/src/main.rs index 0e0de46ab6..c3c0df618b 100644 --- a/drivers/storage/nvmed/src/main.rs +++ b/drivers/storage/nvmed/src/main.rs @@ -92,18 +92,25 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! { executor.register_external_event(time_handle.as_raw_fd() as usize, event::EventFlags::READ), ); - // Try to init namespaces for 5 seconds + // Try to init namespaces for 5 seconds; exit cleanly with non-zero + // status on timeout so init can fall back to another block driver. time_arm(&mut time_handle, 5).expect("failed to arm timer"); - let namespaces = executor.block_on(async { + let namespaces = match executor.block_on(async { let namespaces_future = nvme.init_with_queues(); let time_future = time_events.as_mut().next(); futures::pin_mut!(namespaces_future); futures::pin_mut!(time_future); match futures::future::select(namespaces_future, time_future).await { futures::future::Either::Left((namespaces, _)) => namespaces, - futures::future::Either::Right(_) => panic!("timeout on init"), + futures::future::Either::Right(_) => None, } - }); + }) { + Some(ns) => ns, + None => { + log::error!("nvmed: NVMe initialization timed out after 5s — no namespace available"); + std::process::exit(1); + } + }; log::debug!("Initialized!"); let scheme = Rc::new(RefCell::new(DiskScheme::new( diff --git a/drivers/storage/nvmed/src/nvme/mod.rs b/drivers/storage/nvmed/src/nvme/mod.rs index 2bd517e5ea..1f29a9c32d 100644 --- a/drivers/storage/nvmed/src/nvme/mod.rs +++ b/drivers/storage/nvmed/src/nvme/mod.rs @@ -369,13 +369,6 @@ impl Nvme { }) .await; - /*match comp.status.specific { - 1 => panic!("invalid queue identifier"), - 2 => panic!("invalid queue size"), - 8 => panic!("invalid interrupt vector"), - _ => (), - }*/ - queue } pub async fn create_io_submission_queue(&self, io_sq_id: SqId, io_cq_id: CqId) -> NvmeCmdQueue { @@ -398,12 +391,6 @@ impl Nvme { ) }) .await; - /*match comp.status.specific { - 0 => panic!("completion queue invalid"), - 1 => panic!("invalid queue identifier"), - 2 => panic!("invalid queue size"), - _ => (), - }*/ q }