engines/io_uring: don't set CQSIZE clamp unconditionally
authorJens Axboe <axboe@kernel.dk>
Mon, 10 Jan 2022 02:34:27 +0000 (19:34 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 10 Jan 2022 02:34:27 +0000 (19:34 -0700)
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 <axboe@kernel.dk>
engines/io_uring.c

index 00ae34823f86ec32907700a8118c30a5d3e97ae1..a2533c88e6a2c0bfa819dd782e37888f6f0bc960 100644 (file)
@@ -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;