[Devel] [PATCH vz10 11/12] selftests: net: io_uring_zerocopy.sh: enable io_uring for the test

Konstantin Khorenko khorenko at virtuozzo.com
Fri Dec 19 18:49:53 MSK 2025


That way the test will leave enabled io_uring after the test run.
Need to restore the value which was prior the test running - in case the test does not fail at least.

not tested!

commit 4b16597b522d5555228c06905bc1e4a960db6441 (HEAD -> vz10.ksefelftest.conntracks)
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Fri Dec 19 16:47:42 2025 +0100

     selftests: net: io_uring_zerocopy.sh: restore io_uring sysctl on exit

     Save the original value of kernel.io_uring_disabled before changing
     it and restore it in cleanup handler to ensure the system state is
     restored regardless of test outcome.

     https://virtuozzo.atlassian.net/browse/VSTOR-120995


     Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>

diff --git a/tools/testing/selftests/net/io_uring_zerocopy_tx.sh 
b/tools/testing/selftests/net/io_uring_zerocopy_tx.sh
index 1b0816760534b..7135596ec622e 100755
--- a/tools/testing/selftests/net/io_uring_zerocopy_tx.sh
+++ b/tools/testing/selftests/net/io_uring_zerocopy_tx.sh
@@ -77,9 +77,13 @@ esac

  # Start of state changes: install cleanup handler

+old_io_uring_disabled=""
  cleanup() {
         ip netns del "${NS2}"
         ip netns del "${NS1}"
+       if [ -n "$old_io_uring_disabled" ]; then
+               sysctl -w -q kernel.io_uring_disabled="$old_io_uring_disabled" 2>/dev/null || true
+       fi
  }

  trap cleanup EXIT
@@ -122,6 +126,7 @@ do_test() {
         wait
  }

+old_io_uring_disabled=$(sysctl -n kernel.io_uring_disabled 2>/dev/null || echo "0")
  sysctl -w -q kernel.io_uring_disabled=0

  do_test "${EXTRA_ARGS}"

On 12/16/25 22:04, Aleksei Oladko wrote:
> The io_uring_zerocopy.sh kselftest assumes that io_uring support is
> enabled on the host system. When io_uring is disabled via the
> kernel.io_uring_disabled sysctl, the test fails.
> 
> Explicitly enable io_uring for the test by setting
> kernel.io_uring_disabled=0
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-120995
> 
> Signed-off-by: Aleksei Oladko <aleksey.oladko at virtuozzo.com>
> ---
>   tools/testing/selftests/net/io_uring_zerocopy_tx.sh | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/tools/testing/selftests/net/io_uring_zerocopy_tx.sh b/tools/testing/selftests/net/io_uring_zerocopy_tx.sh
> index 123439545013..1b0816760534 100755
> --- a/tools/testing/selftests/net/io_uring_zerocopy_tx.sh
> +++ b/tools/testing/selftests/net/io_uring_zerocopy_tx.sh
> @@ -122,5 +122,7 @@ do_test() {
>   	wait
>   }
>   
> +sysctl -w -q kernel.io_uring_disabled=0
> +
>   do_test "${EXTRA_ARGS}"
>   echo ok



More information about the Devel mailing list