Handle when io_uring_enter(...) fails with EINTR (#10540)

Motivation:

It is possible that io_uring_enter(...) fails with EINTR. In this case
we should just retry the operation

Modifications:

Retry when EINTR was detected

Result:

More correct use of io_uring_enter(...)
This commit is contained in:
Norman Maurer 2020-09-09 10:05:14 +02:00 committed by GitHub
parent 5bd6611c0e
commit 5ee1f2c7ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -167,7 +167,15 @@ void setup_io_uring(int ring_fd, struct io_uring *io_uring_ring,
static jint netty_io_uring_enter(JNIEnv *env, jclass class1, jint ring_fd, jint to_submit,
jint min_complete, jint flags) {
return sys_io_uring_enter(ring_fd, to_submit, min_complete, flags, NULL);
int result;
int err;
do {
result = sys_io_uring_enter(ring_fd, to_submit, min_complete, flags, NULL);
if (result >= 0) {
return result;
}
} while((err = errno) == EINTR);
return -err;
}
static jint netty_epoll_native_eventFd(JNIEnv* env, jclass clazz) {