diff --git a/src/io.rs b/src/io.rs index f609534..08b893c 100644 --- a/src/io.rs +++ b/src/io.rs @@ -723,7 +723,7 @@ impl UblkQueue<'_> { } #[inline(always)] - fn process_io(&mut self, to_wait: usize) -> Result { + fn wait_ios(&mut self, to_wait: usize) -> Result { info!( "dev{}-q{}: to_submit {} inflight cmd {} stopping {}", self.dev.dev_info.dev_id, @@ -733,10 +733,6 @@ impl UblkQueue<'_> { (self.q_state & UBLK_QUEUE_STOPPING) ); - if self.queue_is_done() && self.q_ring.submission().is_empty() { - return Err(UblkError::QueueIsDown(-libc::ENODEV)); - } - let ret = self .q_ring .submit_and_wait(to_wait) @@ -807,7 +803,11 @@ impl UblkQueue<'_> { where F: FnMut(&mut UblkIOCtx) -> Result, { - match self.process_io(to_wait) { + if self.queue_is_done() && self.q_ring.submission().is_empty() { + return Err(UblkError::QueueIsDown(-libc::ENODEV)); + } + + match self.wait_ios(to_wait) { Err(r) => Err(r), Ok(done) => { for idx in 0..done {