From b5e99df6ec605b4dc6a3488203f32d5c5bfce8df Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sun, 9 Jan 2022 19:34:27 -0700 Subject: [PATCH] engines/io_uring: don't set CQSIZE clamp unconditionally For older kernels without IORING_SETUP_CQSIZE, we'll get EINVAL if we set it. Just retry the ring setup if that happens. Link: https://github.com/axboe/fio/issues/1324 Signed-off-by: Jens Axboe --- engines/io_uring.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/engines/io_uring.c b/engines/io_uring.c index 00ae3482..a2533c88 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -699,9 +699,15 @@ static int fio_ioring_queue_init(struct thread_data *td) p.flags |= IORING_SETUP_CQSIZE; p.cq_entries = depth; +retry: ret = syscall(__NR_io_uring_setup, depth, &p); - if (ret < 0) + if (ret < 0) { + if (errno == EINVAL && p.flags & IORING_SETUP_CQSIZE) { + p.flags &= ~IORING_SETUP_CQSIZE; + goto retry; + } return ret; + } ld->ring_fd = ret; -- 2.25.1