Repository navigation
feat: typed SqpollUnavailable error on CAP_SYS_NICE missing (SQP-LAND.5) - #5558
Merged
Merged
Conversation
Per SQP-LAND.1 audit (PR #5548), `build_ring()` previously discarded the SQPOLL setup errno and set `SQPOLL_FALLBACK` without a log, leaving operators unable to tell whether a slow daemon was running with a downgraded ring. Add a typed `IoUringRestriction::SqpollUnavailable { hint }` variant and capture the errno when `IORING_SETUP_SQPOLL` is rejected so the cause can be distinguished: - `EPERM`: rootless container or missing `CAP_SYS_NICE` - `ENOSYS`: kernel predates `IORING_SETUP_SQPOLL` - other: generic kernel rejection (errno surfaced numerically) The hint is logged via `debug_log!(Io, 1, ...)` and latched in a `OnceLock` so callers (`--io-uring-status`, daemon log, structured error reporting) can read the same wording without parsing logs. A stub for non-Linux platforms mirrors the API surface. SQP-LAND.4 will wire `detect_io_uring_restriction()` to surface `SqpollUnavailable` when the latched hint is present; this PR keeps the detection function unchanged and only introduces the variant and log so the wire-up can land independently.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
….5) (#5558) Per SQP-LAND.1 audit (PR #5548), `build_ring()` previously discarded the SQPOLL setup errno and set `SQPOLL_FALLBACK` without a log, leaving operators unable to tell whether a slow daemon was running with a downgraded ring. Add a typed `IoUringRestriction::SqpollUnavailable { hint }` variant and capture the errno when `IORING_SETUP_SQPOLL` is rejected so the cause can be distinguished: - `EPERM`: rootless container or missing `CAP_SYS_NICE` - `ENOSYS`: kernel predates `IORING_SETUP_SQPOLL` - other: generic kernel rejection (errno surfaced numerically) The hint is logged via `debug_log!(Io, 1, ...)` and latched in a `OnceLock` so callers (`--io-uring-status`, daemon log, structured error reporting) can read the same wording without parsing logs. A stub for non-Linux platforms mirrors the API surface. SQP-LAND.4 will wire `detect_io_uring_restriction()` to surface `SqpollUnavailable` when the latched hint is present; this PR keeps the detection function unchanged and only introduces the variant and log so the wire-up can land independently.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
IoUringConfig::build_ring()previously discarded the SQPOLL setup errno and setSQPOLL_FALLBACKwithout a log. Users debugging "why is my daemon slow?" could not tell that SQPOLL was disabled or why.IoUringRestriction::SqpollUnavailable { hint }variant plus aOnceLock-latched hint accessor so the cause survives the build path and is readable by--io-uring-status, daemon log, and structured callers.err.raw_os_error()whenIORING_SETUP_SQPOLLis rejected and compose a hint distinguishingEPERM(rootless container / missingCAP_SYS_NICE),ENOSYS(kernel predates SQPOLL), and generic kernel rejection. The hint is emitted viadebug_log!(Io, 1, ...).This PR is independent of SQP-LAND.4 - it introduces the typed variant and log only. SQP-LAND.4 will wire
detect_io_uring_restriction()to consume the latched hint.Variant definition
Log message (EPERM case)
Test plan
SqpollUnavailablevariant constructs and renders verbatim throughDisplayIoUringRestriction::Nonesqpoll_unavailability_hint()is queryable without panic before any failure is observedsqpoll_fallback_hint,sqpoll_unavailability_hint) so cross-platform callers do not need conditional compilation