From 93125eea2afea3135a4b1bdf9344fc24fa12418e Mon Sep 17 00:00:00 2001 From: Bob Chen Date: Wed, 16 Aug 2023 13:53:27 +0800 Subject: [PATCH] Update iouring-wrapper.cpp (#176) The io_uring wait timeout bug has been backport to kernel 5.15 in earlier 2023 --- io/iouring-wrapper.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/io/iouring-wrapper.cpp b/io/iouring-wrapper.cpp index 3f32e6a1..2dfa4274 100644 --- a/io/iouring-wrapper.cpp +++ b/io/iouring-wrapper.cpp @@ -446,7 +446,7 @@ class iouringEngine : public MasterEventEngine, public CascadingEventEngine { // Batch submit all SQEs int ret = io_uring_submit_and_wait(ring, 1); if (ret <= 0) { - LOG_ERROR_RETURN(0, -1, "iouring: failed to submit io") + LOG_ERRNO_RETURN(0, -1, "iouring: failed to submit io") } return 0; } @@ -455,7 +455,7 @@ class iouringEngine : public MasterEventEngine, public CascadingEventEngine { // Batch submit all SQEs int ret = io_uring_submit_and_wait_timeout(ring, cqe, 1, ts, nullptr); if (ret < 0 && ret != -ETIME) { - LOG_ERROR_RETURN(0, -1, "iouring: failed to submit io"); + LOG_ERRNO_RETURN(0, -1, "iouring: failed to submit io"); } return 0; } @@ -465,12 +465,13 @@ class iouringEngine : public MasterEventEngine, public CascadingEventEngine { static void set_submit_wait_function() { // The submit_and_wait_timeout API is more efficient than setting up a timer and waiting for it. - // But there is a kernel bug before 5.17, so choose appropriate function here. + // But there is a kernel bug before 5.15, so choose appropriate function here. // See https://git.kernel.dk/cgit/linux-block/commit/?h=io_uring-5.17&id=228339662b398a59b3560cd571deb8b25b253c7e + // and https://www.spinics.net/lists/stable/msg620268.html if (m_submit_wait_func) return; int result; - if (kernel_version_compare("5.17", result) == 0 && result >= 0) { + if (kernel_version_compare("5.15", result) == 0 && result >= 0) { m_submit_wait_func = submit_wait_by_api; } else { m_submit_wait_func = submit_wait_by_timer;