-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
io_uring_prep_close_direct fails when IOSQE_FIXED_FILE is set #1325
Comments
Don't set |
Closing, reopen if there are further questions. |
Well, I'm already not setting it any more - hopefully at least this thread is helpful in case someone makes the same mistake in the future. It arose for me due to a helper function that was setting the flag for all my ops since I'm exclusively using registered fds. Thanks for the input. |
It is a bit confusing imho, I'll add a blurb to the man page about it. |
The application must not set IOSQE_FIXED_FILE for closing a direct descriptor, the helper will correctly assign the direct descriptor index to close. Link: #1325 Signed-off-by: Jens Axboe <[email protected]>
I've identified some unexpected (at least to me) behavior when using IOSQE_FIXED_FILE with
io_uring_prep_close_direct
ops. When this flag is set, close operations consistently fail, while they succeed otherwise. The same flag has no effect on socket creation operations (usingio_uring_prep_socket_direct_alloc
or alsoio_uring_prep_socket_direct
, the latter not demonstrated here). While the documentation doesn't state that IOSQE_FIXED_FILE should work with direct close operations or that it should be used, this was unexpected to me because most other direct ops require the flag, and especially because socket creation also seems to work fine with it.I am on Linux 6.12.7 and liburing 2.8.
The attached code demonstrates this behavior by maintaining a rotating pool of socket file descriptors, where new sockets are created and old ones are closed to maintain a maximum number of open files. The code runs the same sequence twice - once with IOSQE_FIXED_FILE and once without. Here is the output I see:
The text was updated successfully, but these errors were encountered: