Skip to content

Build async-io on macOS and report why io-uring isn't available - #270

Merged
jiangliu merged 3 commits into
cloud-hypervisor:masterfrom
Kranzes:async-io-macos
Oct 30, 2026
Merged

jiangliu merged 3 commits into
cloud-hypervisor:masterfrom
Kranzes:async-io-macos

Conversation

@Kranzes

@Kranzes Kranzes commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

async-io only builds on Linux, because it pulls in io-uring on every platform. Most of the async code doesn't need io_uring, and the tokio runtime already serves Linux without it. This builds async-io on macOS, where it runs on tokio.

  • async-io: build the generic async code without io_uring. AsyncFileReadWriteVolatile used tokio_uring only for IoBuf::bytes_total(), and the Vfs async handlers used the Linux-only libc::stat64 and VfsOptions::no_open. The umbrella crate forwards async-io to the transports with pkg?/feature, so async-io alone no longer pulls in the Linux-only virtiofs transport.
  • async-io: build on macOS, where it runs on tokio. io-uring becomes a Linux-only dependency of fuse-backend-core, like tokio-uring. The macfuse example gets the AsyncFileSystem impl that async-io requires, and make check-macos builds, lints and tests async-io.
  • core/async-io: report why io-uring isn't available. set_runtime_type(RuntimeType::Uring) returned "async runtime type is Tokio, not Uring" when the probe failed, and only the log said why. It now returns the probe's error with its kind, so an application can tell a low RLIMIT_MEMLOCK from a seccomp filter. The test blocks io_uring_setup() with a seccomp filter.

This changes the umbrella crate's async-io. It no longer turns on the fusedev and virtiofs transports, so code that uses items they gate, such as abi::virtio_fs, has to enable them. A crate that depends on a transport crate directly must enable that crate's async-io too, or its writers fail asynchronous replies with EINVAL.

The asynchronous fusedev transport (FuseDevTask, AsyncFuseServing) stays Linux-only. fuse-backend-fusedev's own io-uring dependency for the fusedev-uring feature is unchanged.

Tested on Linux 7.2.10 with make check and the mount tests in a user namespace. For macOS, cargo check --target aarch64-apple-darwin --tests and clippy pass with fusedev,async-io and fusedev,fuse-t,async-io, and an earlier version of this branch built on macOS 26 (arm64). I don't have macFUSE set up, so nothing mounted on macOS.

@jiangliu

Copy link
Copy Markdown
Collaborator

@Kranzes let's work on this PR first, then #268

AsyncFileReadWriteVolatile used tokio_uring only for
IoBuf::bytes_total(), so call FileVolatileBuf::cap() instead. The vfs
async handlers used the Linux-only libc::stat64 and
VfsOptions::no_open, so use fuse_abi::stat64 and check no_open on
Linux only.

The umbrella crate now forwards async-io to the transports with
pkg?/feature, so async-io alone no longer pulls in the Linux-only
virtiofs transport.

Signed-off-by: Ilan Joselevich <personal@ilanjoselevich.com>
async-io failed to build on macOS, because it pulled in io-uring on
every platform and io-uring only builds on Linux. The code that uses
io_uring was already Linux-only.

Make io-uring a Linux-only dependency, like tokio-uring. Other
platforms run async-io on tokio. The macfuse example gets the
AsyncFileSystem impl that async-io requires, and the Makefile builds
and tests async-io on macOS.

Signed-off-by: Ilan Joselevich <personal@ilanjoselevich.com>
When the io-uring probe failed, set_runtime_type(RuntimeType::Uring)
returned "async runtime type is Tokio, not Uring". The probe only
logged its reason, so an application couldn't tell a low
RLIMIT_MEMLOCK from a seccomp filter.

Keep the probe's error and return it from set_runtime_type(), with its
kind. The fallback warning includes it too. The test blocks
io_uring_setup() with a seccomp filter, and skips where it can't
install one, such as under QEMU.

Signed-off-by: Ilan Joselevich <personal@ilanjoselevich.com>
@Kranzes Kranzes changed the title [NEEDS #267] Build async-io on macOS and report why io-uring isn't available Build async-io on macOS and report why io-uring isn't available Oct 29, 2026
@Kranzes

Kranzes commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto master, and #271 on top of it. #268 conflicts with this one in Vfs::async_open(), so I'll rebase #268 again once this lands.

@jiangliu
jiangliu merged commit 9c07946 into cloud-hypervisor:master Oct 30, 2026
12 checks passed
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