From ac16a6beca118439eccb80b03d4925bd898707ae Mon Sep 17 00:00:00 2001 From: Yuri Konotopov Date: Sat, 29 Aug 2026 07:34:37 +0000 Subject: [PATCH 5/5] Fixed SQPOLL fallback on permission errors Signed-off-by: Yuri Konotopov Forwarded: https://github.com/mosquito/caio/pull/76 --- caio/linux_uring.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/caio/linux_uring.c b/caio/linux_uring.c index abd5200..008d882 100644 --- a/caio/linux_uring.c +++ b/caio/linux_uring.c @@ -682,8 +682,8 @@ static int AIOContext_init(AIOContext *self, PyObject *args, PyObject *kwds) { * * Opt-in (sqpoll=True): SQPOLL kernel thread polls SQ ring; io_uring_enter * only needed to wake a sleeping thread. Eliminates per-op syscall - * overhead at sustained high QD. EPERM on pre-5.11 kernels without - * CAP_SYS_NICE is treated like EINVAL (try next entry). + * overhead at sustained high QD. Permission errors are treated like + * EINVAL (try next entry), allowing fallback to a plain ring. * * IORING_SETUP_SINGLE_ISSUER deliberately never tried: it pins the ring * to whichever thread's io_uring_setup()/io_uring_enter() call created @@ -719,7 +719,7 @@ static int AIOContext_init(AIOContext *self, PyObject *args, PyObject *kwds) { flags_used = params.flags; break; } - if (errno != EINVAL && errno != EPERM) { + if (errno != EINVAL && errno != EPERM && errno != EACCES) { PyErr_SetFromErrno(PyExc_SystemError); return -1; } -- 2.55.0