From 3e6c9b9d0d3dd93cb143430ec1cacf030cab2f8e Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 7 Oct 2024 11:54:23 -0600 Subject: [PATCH] test/sync-cancel: don't fail on missing IORING_ASYNC_CANCEL_OP 6.1-stable fails this test case, as it does have sync cancel support, but does not support IORING_ASYNC_CANCEL_OP. Hence we pass the initial testing, but fail when we start using this flag. Return T_EXIT_PASS if we get this far, as the initial sync cancel testing did pass. Signed-off-by: Jens Axboe --- test/sync-cancel.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/sync-cancel.c b/test/sync-cancel.c index 75a33cc11..eb6705490 100644 --- a/test/sync-cancel.c +++ b/test/sync-cancel.c @@ -13,7 +13,7 @@ #include "liburing.h" #include "helpers.h" -static int no_sync_cancel; +static int no_sync_cancel, no_sync_cancel_op; static int test_sync_cancel_timeout(struct io_uring *ring, int async, int by_op) { @@ -47,6 +47,11 @@ static int test_sync_cancel_timeout(struct io_uring *ring, int async, int by_op) reg.opcode = IORING_OP_READ; reg.timeout.tv_nsec = 1; ret = io_uring_register_sync_cancel(ring, ®); + /* earlier kernels had sync cancel, but not per-op */ + if (ret == -EINVAL) { + no_sync_cancel_op = 1; + return 0; + } if (async) { /* we expect -ETIME here, but can race and get 0 */ if (ret != -ETIME && ret != 0) { @@ -244,6 +249,8 @@ int main(int argc, char *argv[]) fprintf(stderr, "test_sync_cancel_timeout 0 0\n"); return T_EXIT_FAIL; } + if (no_sync_cancel_op) + return T_EXIT_PASS; ret = test_sync_cancel_timeout(&ring, 0, 1); if (ret) {