From 5286f453115145346fb9fc476c216235f1113473 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 17 Mar 2024 21:03:17 +0100 Subject: [PATCH] Fix potential race in nvmed Previously it was possible to submit commands before the event queue is created by the irq handler thread. --- storage/nvmed/src/nvme/cq_reactor.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/storage/nvmed/src/nvme/cq_reactor.rs b/storage/nvmed/src/nvme/cq_reactor.rs index 5926684974..ccadb14941 100644 --- a/storage/nvmed/src/nvme/cq_reactor.rs +++ b/storage/nvmed/src/nvme/cq_reactor.rs @@ -271,11 +271,9 @@ pub fn start_cq_reactor_thread( // subsystem can have some room for improvement regarding lowering the latency, but MSI-X allows // multiple vectors to point to different CPUs, so that the load can be balanced across the // logical processors. - thread::spawn(move || { - CqReactor::new(nvme, interrupt_sources, receiver) - .expect("nvmed: failed to setup CQ reactor") - .run() - }) + let reactor = CqReactor::new(nvme, interrupt_sources, receiver) + .expect("nvmed: failed to setup CQ reactor"); + thread::spawn(move || reactor.run()) } #[derive(Debug)]