From fa8acbd712ebf6574938191aaf846001e3be8d1e Mon Sep 17 00:00:00 2001 From: Dylan Reid Date: Fri, 24 Apr 2026 17:09:06 -0700 Subject: [PATCH] virtio-devices: block: track non-batch inflight reqs immediately For non-batch backends execute_async submits the kernel I/O inline before returning. An early return while processing before inserting in inflight_requests, meant the request went untracked, the local batch list was never appended to inflight_requests, even though the request is pending in the kernel. To track it, insert into self.inflight_requests as soon as execute_async returns Ok. The completion path's find_inflight_request now matches the orphan and the bounce buffer is freed only after the kernel signals it is done. Signed-off-by: Dylan Reid --- virtio-devices/src/block.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/virtio-devices/src/block.rs b/virtio-devices/src/block.rs index e6e8596e0..bdaf46a89 100644 --- a/virtio-devices/src/block.rs +++ b/virtio-devices/src/block.rs @@ -326,8 +326,11 @@ impl BlockEpollHandler { ) } } + batch_inflight_requests.push((desc_chain.head_index(), request)); + } else { + self.inflight_requests + .push_back((desc_chain.head_index(), request)); } - batch_inflight_requests.push((desc_chain.head_index(), request)); } else { let status = match result { Ok(_) => VIRTIO_BLK_S_OK,