Visitar URL original
block: Reissue io_uring requests that complete with -EAGAIN by doge-rgb · Pull Request #8966 · cloud-hypervisor/cloud-hypervisor · GitHub
Skip to content

block: Reissue io_uring requests that complete with -EAGAIN - #8966

Open
doge-rgb wants to merge 1 commit into
cloud-hypervisor:mainfrom
doge-rgb:uring-reissue-eagain
Open

doge-rgb wants to merge 1 commit into
cloud-hypervisor:mainfrom
doge-rgb:uring-reissue-eagain

Conversation

@doge-rgb

Copy link
Copy Markdown
Contributor

On our XFS hosts (Linux 6.12), guests logged read errors under concurrent writes:

Buffer I/O error on dev vdc, logical block 38190087, async page read

For each of them the VMM logged:

WARN:virtio-devices/src/block.rs:584 -- Request failed: Request { request_type: In, sector: 77a98, ... } Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }

The data on disk was intact. On the host, each failed request was an iomap_dio_complete trace event with error -11 in a kworker, followed by an io_uring_complete event with result -11. Kernels with b08e02045002 (6.14) retry such requests in io_uring.

Tested with two new unit tests, the first of which fails on main. They skip on kernels before 6.4, where pipes do not support RWF_NOWAIT. In a Linux guest on an XFS host, 4 threads wrote random 4 KiB blocks with O_DIRECT into a fallocated 32 GiB file while 4 threads read the disk range under it in 1 MiB O_DIRECT reads, for 5 minutes: on main 1,036,069 of 3,714,530 reads failed with EIO, with this change none of 3,168,618 did.

io_uring can complete an O_DIRECT read with -EAGAIN on kernels without
commit b08e02045002 ("io_uring/rw: don't gate retry on completion
context"), which was merged for Linux 6.14. This happens on XFS for a
read that spans several extents when a concurrent allocating write
holds the inode lock: the bios for the first extents are already in
flight when mapping a later extent fails with -EAGAIN, iomap completes
the request from a workqueue, and io_uring does not retry it outside
the submitting task. virtio-blk then reports VIRTIO_BLK_S_IOERR to the
guest for data that is intact.

Reissue a read or write that completes with -EAGAIN or -EINTR once,
with IOSQE_ASYNC so that io-wq runs it in blocking mode, where it
cannot fail this way again. QEMU resubmits both errors as well.

Signed-off-by: doge <me@crackerben.com>
@doge-rgb
doge-rgb requested a review from a team as a code owner September 30, 2026 09:41

@rbradford rbradford left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you but this needs some very careful review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants