Re: BUG #19369: Not documented that io_uring on kernel versions between 5.1 and below 5.6 does not work

surya poondla <suryapoondla4@gmail.com>

From: surya poondla <suryapoondla4@gmail.com>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Andres Freund <andres@anarazel.de>, Pierre Forstmann <pierre.forstmann@gmail.com>, "Si, Evan" <evsi@amazon.com>, "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2026-01-15T20:27:23Z
Lists: pgsql-bugs

Attachments

>
> Sure Andres, I am working on a patch which emits a useful error message
> too.
>


Hi All,


I prepared a patch that implements an early detection of unsupported
io_uring operations during PostgreSQL startup, before any I/O is attempted.
The patch focuses on

  1. Clear error message at startup instead of cryptic EINVAL during
queries.

  2. Immediate failure with actionable hints (upgrade kernel or use
io_method=worker)

  3. Prevents PostgreSQL from starting in a broken state


Before the patch:

  1. PostgreSQL started successfully

  2. Connection attempts failed with EINVAL errors


After patch:

  1. PostgreSQL refuses to start

  2. Clear error message that looks like:

    "FATAL: kernel does not support required io_uring operations"
    "DETAIL:  The kernel supports io_uring but lacks one or more of the
required opcodes (IORING_OP_READ, IORING_OP_WRITE, IORING_OP_READV,
IORING_OP_WRITEV). This typically occurs on Linux kernels older than 5.6."

    "HINT: Either upgrade your kernel to version 5.6 or newer, or

     use io_method=worker"


Modified files in the Patch:

  1. configure.ac: Added io_uring_opcode_supported to AC_CHECK_FUNCS

  2. meson.build: Added corresponding function check for Meson build

  3. src/backend/storage/aio/method_io_uring.c: Added
is_uring_read_write_unsupported() function, that is integrated into
pgaio_uring_init() and reports clear error with details and hints.


I tested the patch on Ubuntu server with Linux kernel 5.4.0-216-generic,
and when io_uring is enabled I see that postgres doesn’t start (expected
behavior).


The existing error handling for kernels < 5.1 (ENOSYS) is preserved.


Regards,
Surya Poondla