Skip to content

Correct handling of errors returned from io_uring_submit() #1511

@iboukris

Description

@iboukris

Hi, this is a theoretical question to design the code properly.

What are the possible errors returned from io_uring_submit() and how to handle them? The example code either does not check the return value or expects all the enqueued SQE to be submitted, while the man page isn't too meticulous either and only says that it returns -errno on failure.

It looks like there are three kind of possible errors, when it returns less than the number of submitted SQE, when it returns -EAGAIN or -EINTR and when it returns any other error. Can any of these be a fatal error (like bad configuration or wrong code)? Otherwise, in case of an ephemeral error, is the only way to handle it is to try and call it again?

Assuming I only submit one SQE by one, can the io_uring_get_sqe() be undone in case io_uring_submit() returns an error, in order to clear up the ring for potentially more important operations for instance?

[P.S. not using SQPOLL]

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions