Closed ytwang3579 closed 1 week ago
Hi @ytwang3579,
After investigating, turns out this was a bug in Ubuntu 22.04 LTS kernel, specifically in Ubuntu-5.15.0-113.123 (the Ubuntu 22.04 LTS current default kernel) and I assume also in previous versions. In fact, it was fixed by @axboe in Ubuntu-5.15.0-115.125 on this commit.
The problem was not returning an exit code (0) on success and instead returning the previously assigned error value for the return variable.
I guess the solution to your case is to update to a newer Ubuntu version with the kernel Ubuntu-5.15.0-115.125 or above.
Sorry missed this - yes indeed like @RogerMarcoHernandez says, this is a kernel bug in the distro kernel you are using. If you upgrade, it should be fine. In terms of the stable series of 5.x kernels, 5.4 will be too ancient for you, but 5.10 or 5.15 based should be OK for SQPOLL and registered files.
In general, as per usual, I always recommend people at least run a 6.x based kernel.
Hi, I was trying to use io_uring with SQPOLL mode for a simple network server example. When I tried to register fd with io_uring_register_files(), I am constantly getting "Bad file descriptor" error. I was doing the initialization of io_uring with the following code:
Always getting the following error:
The server example is working without SQPOLL mode. I was trying to register the server_fd to get familiar with the SQPOLL feature. Am I doing anything wrong here?
I also tried running the tests provided using
sudo make runtests
, and it seems like the fds are not able to be registered in all the tests, giving the same -EBADF (-9) error:What are the requirements for io_uring_register_files() to work? I was only seeing kernel version >= 5.1 here. Thanks in advance!
Full test log: io_uring_test_result.txt Environment (both failed):