{"id":2219723,"url":"http://patchwork.ozlabs.org/api/patches/2219723/?format=json","web_url":"http://patchwork.ozlabs.org/project/ltp/patch/20260404011340.13288-1-wegao@suse.com/","project":{"id":59,"url":"http://patchwork.ozlabs.org/api/projects/59/?format=json","name":"Linux Test Project development","link_name":"ltp","list_id":"ltp.lists.linux.it","list_email":"ltp@lists.linux.it","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260404011340.13288-1-wegao@suse.com>","list_archive_url":null,"date":"2026-04-04T01:13:27","name":"[v7] io_submit04: Add test case for RWF_NOWAIT flag","commit_ref":null,"pull_url":null,"state":"needs-review-ack","archived":false,"hash":"67aed42d6f99c4a8632c133a7e7aba1d19ec1ac9","submitter":{"id":85577,"url":"http://patchwork.ozlabs.org/api/people/85577/?format=json","name":"Wei Gao","email":"wegao@suse.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ltp/patch/20260404011340.13288-1-wegao@suse.com/mbox/","series":[{"id":498690,"url":"http://patchwork.ozlabs.org/api/series/498690/?format=json","web_url":"http://patchwork.ozlabs.org/project/ltp/list/?series=498690","date":"2026-04-04T01:13:27","name":"[v7] io_submit04: Add test case for RWF_NOWAIT flag","version":7,"mbox":"http://patchwork.ozlabs.org/series/498690/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2219723/comments/","check":"success","checks":"http://patchwork.ozlabs.org/api/patches/2219723/checks/","tags":{},"related":[],"headers":{"Return-Path":"<ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>","X-Original-To":["incoming@patchwork.ozlabs.org","ltp@lists.linux.it"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","ltp@picard.linux.it"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=lists.linux.it header.i=@lists.linux.it\n header.a=rsa-sha256 header.s=picard header.b=BNBAe+d0;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256\n header.s=google header.b=Vkzz8jeO;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it\n (client-ip=2001:1418:10:5::2; helo=picard.linux.it;\n envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it;\n receiver=patchwork.ozlabs.org)"],"Received":["from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fnd013l8zz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 04 Apr 2026 12:13:53 +1100 (AEDT)","from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id DF0393E4E60\n\tfor <incoming@patchwork.ozlabs.org>; Sat,  4 Apr 2026 03:13:50 +0200 (CEST)","from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it\n [IPv6:2001:4b78:1:20::3])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n (No client certificate requested)\n by picard.linux.it (Postfix) with ESMTPS id E1F123E4E54\n for <ltp@lists.linux.it>; Sat,  4 Apr 2026 03:13:45 +0200 (CEST)","from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com\n [IPv6:2a00:1450:4864:20::32d])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 141841A00888\n for <ltp@lists.linux.it>; Sat,  4 Apr 2026 03:13:45 +0200 (CEST)","by mail-wm1-x32d.google.com with SMTP id\n 5b1f17b1804b1-488971db0fdso12761535e9.0\n for <ltp@lists.linux.it>; Fri, 03 Apr 2026 18:13:45 -0700 (PDT)","from localhost ([2a07:de40:b240:0:2ad6:ed42:2ad6:ed42])\n by smtp.gmail.com with UTF8SMTPSA id\n 5b1f17b1804b1-48899e491afsm30800315e9.17.2026.04.03.18.13.43\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 03 Apr 2026 18:13:43 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=lists.linux.it;\n i=@lists.linux.it; q=dns/txt; s=picard; t=1775265230; h=to : date :\n message-id : in-reply-to : references : mime-version : subject :\n list-id : list-unsubscribe : list-archive : list-post : list-help :\n list-subscribe : from : reply-to : content-type :\n content-transfer-encoding : sender : from;\n bh=qwhKRMtW8z8QYGQljvGMfU+cXfLWTA2UQa/nLEq+Tto=;\n b=BNBAe+d0xP4WQLvwaFVKnjKEasp4GuNkkojotEnqmsUBEx+QfoTtd67biE0grQ2USyHQd\n vSwwZZPOgy+FYr2J8fvUdiQgYKL2si7qK8Ui8S0+b4MGIYsRDJbIZWfklxHVkNR9u7gnuBA\n D51it9ouBMOsU9AohYRmhfeKsC/exbQ=","v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=suse.com; s=google; t=1775265224; x=1775870024; darn=lists.linux.it;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=qCykQF2kCC5zwqjvHfl6Ie9BAloloa6IQFULWPdkKCk=;\n b=Vkzz8jeOa/QXj6dCesklECpJVEUYcTM/J8PaB+bxtF4c8oUyUme/wPm3ScoqPn2sFf\n lprLX2ptjF4rZNudk1NvsjGsHEaxXzIenEukjeMpopFBWYeIWAomR8S/tzp0jtFYWjN/\n Ham7pc9bj33gHqo55H6Cd2pZKEV1oTWLjZLu9tnmTlfOqLl/UELb1zFwOt8vlGrGAQUX\n PHQdBUV2M3srBFMw43XK4ESMkG7CElnQKXh097AGQWFpcH0+acIHyyUyPNYWWYU8+77d\n a+xrlxph0ZhxdExgwhRcbmNLckuREgUuyfCpsq0mgPEuRdIJbKHNGj3+JXl9lSdNrDi/\n wMrw=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775265224; x=1775870024;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=qCykQF2kCC5zwqjvHfl6Ie9BAloloa6IQFULWPdkKCk=;\n b=VGqwt6FJa3srrdcFUR9HO1r0pq733fOvaHxK/VsZJpA+6EaPbAjmUjuyHSQsfzjCwL\n hVIBTSwQcTfjH73nrMLMn0FXaUHbf38k7joHrNRWpaM1JJaHc1wbMGJcGqSNsqiO8plR\n IZUx+H+zxn0CEbQK4kWV8gFDcn/P6T3xXaqFfE0uA6zbrUnFpcZ2oD75qrML+Siq0SUf\n Qqo1EpiiJPQWQwZ9Ri32DXwslNLK7dMSMmNxTUT00UBDCxb0kk2WW634OmzKLT9Y/YE3\n 0yN35PWERh1ztURjuZhzt5Wpo3kMcsbkXF2XPMAZ+R8BdbhkIRgxYTLYAt56W1sa7HBD\n j0mw==","X-Gm-Message-State":"AOJu0YxnZlvrcPPXVupvHGLVJ6pMLGcNFwR+lWGMgSI/K/yK+reEkU3r\n oBYSueW10nGONpTDt7mjGxJABKtw5QBCw56q2ZOvz1zy9diYRnH5cN7mRgfbXc7i7MxjVPxCC2I\n fZGU=","X-Gm-Gg":"AeBDieuGhGxJzpd6CEZfpWopPeqiwanGeCeSWhXKwPr1u5tjlBRjaDQF89agkEHzV/Q\n WulFyOhkYkVW9M7nGtE2nn+USSMX70/rNN1kH2pSyZhPkgOt1RXps+uQGmbN1BdisnITsEASV1E\n gK6ugzEwKvPyTH2G6fzbPjp45wKKqYElmwCeUmhjQLzs6av9FCrmiNeqWPIOcWVZV4xywaZcEoZ\n uzzajpo9eIwB3puAMvz/PKkon90SClyH+qIAf34VTcwlJQ4TML4kMY+P17uvRaTljfWlaTWWoIg\n uBbEiLk1tFnUsvPZunaSlODM+C5p/CdB1z+GRBBwmRPYrs3QUvPCudnaaB8kV6AwZctHPrQxEM0\n xsRDNKdyLyzmEjwCJzDG7GhGYcbKSAwj78Wu1xs1cH/iNwx/kO8Soe4nD5l+xmXLWm9KwheL0+H\n fLV0Tc9/DlZM0=","X-Received":"by 2002:a05:600c:8b34:b0:487:1fb4:7e1 with SMTP id\n 5b1f17b1804b1-488997d530fmr75228035e9.22.1775265224149;\n Fri, 03 Apr 2026 18:13:44 -0700 (PDT)","To":"ltp@lists.linux.it","Date":"Sat,  4 Apr 2026 01:13:27 +0000","Message-ID":"<20260404011340.13288-1-wegao@suse.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20260317114635.944-1-wegao@suse.com>","References":"<20260317114635.944-1-wegao@suse.com>","MIME-Version":"1.0","X-Spam-Status":"No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no\n autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on in-3.smtp.seeweb.it","X-Virus-Scanned":"clamav-milter 1.0.9 at in-3.smtp.seeweb.it","X-Virus-Status":"Clean","Subject":"[LTP] [PATCH v7] io_submit04: Add test case for RWF_NOWAIT flag","X-BeenThere":"ltp@lists.linux.it","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux Test Project <ltp.lists.linux.it>","List-Unsubscribe":"<https://lists.linux.it/options/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=unsubscribe>","List-Archive":"<http://lists.linux.it/pipermail/ltp/>","List-Post":"<mailto:ltp@lists.linux.it>","List-Help":"<mailto:ltp-request@lists.linux.it?subject=help>","List-Subscribe":"<https://lists.linux.it/listinfo/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=subscribe>","From":"Wei Gao via ltp <ltp@lists.linux.it>","Reply-To":"Wei Gao <wegao@suse.com>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it","Sender":"\"ltp\" <ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>"},"content":"Fixes: #467\nSigned-off-by: Wei Gao <wegao@suse.com>\n---\nv6->v7:\n- Fix 32bit issue, use TST_PTR_TO_UINT convert buf\n- Updated the comment header to use the :manpage:\n- Simplify logic in cleanup()\n\n configure.ac                                  |  1 +\n include/lapi/aio_abi.h                        | 44 +++++++++\n runtest/syscalls                              |  1 +\n .../kernel/syscalls/io_submit/.gitignore      |  1 +\n .../kernel/syscalls/io_submit/io_submit04.c   | 99 +++++++++++++++++++\n 5 files changed, 146 insertions(+)\n create mode 100644 include/lapi/aio_abi.h\n create mode 100644 testcases/kernel/syscalls/io_submit/io_submit04.c","diff":"diff --git a/configure.ac b/configure.ac\nindex e5d3ce063..812f17d8b 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -173,6 +173,7 @@ AC_CHECK_FUNCS_ONCE([ \\\n ])\n AC_CHECK_FUNCS(mkdtemp,[],AC_MSG_ERROR(mkdtemp() not found!))\n \n+AC_CHECK_MEMBERS([struct iocb.aio_rw_flags],,,[#include <linux/aio_abi.h>])\n AC_CHECK_MEMBERS([struct fanotify_event_info_fid.fsid.__val],,,[#include <sys/fanotify.h>])\n AC_CHECK_MEMBERS([struct perf_event_mmap_page.aux_head],,,[#include <linux/perf_event.h>])\n AC_CHECK_MEMBERS([struct sigaction.sa_sigaction],[],[],[#include <signal.h>])\ndiff --git a/include/lapi/aio_abi.h b/include/lapi/aio_abi.h\nnew file mode 100644\nindex 000000000..ac78e5500\n--- /dev/null\n+++ b/include/lapi/aio_abi.h\n@@ -0,0 +1,44 @@\n+// SPDX-License-Identifier: GPL-2.0-or-later\n+/*\n+ * Copyright (c) 2025 Wei Gao <wegao@suse.com>\n+ */\n+\n+#ifndef LAPI_AIO_ABI_H__\n+#define LAPI_AIO_ABI_H__\n+\n+#include <endian.h>\n+#include <linux/aio_abi.h>\n+\n+#ifndef RWF_NOWAIT\n+# define RWF_NOWAIT 0x00000008\n+#endif\n+\n+struct iocb_fallback {\n+\tuint64_t aio_data;\n+#if __BYTE_ORDER == __LITTLE_ENDIAN\n+\tuint32_t   aio_key;\n+\tuint32_t aio_rw_flags;\n+#elif __BYTE_ORDER == __BIG_ENDIAN\n+\tuint32_t aio_rw_flags;\n+\tuint32_t   aio_key;\n+#else\n+#error edit for your odd byteorder.\n+#endif\n+\tuint16_t   aio_lio_opcode;\n+\tint16_t   aio_reqprio;\n+\tuint32_t   aio_fildes;\n+\tuint64_t   aio_buf;\n+\tuint64_t   aio_nbytes;\n+\tint64_t   aio_offset;\n+\tuint64_t   aio_reserved2;\n+\tuint32_t   aio_flags;\n+\tuint32_t   aio_resfd;\n+};\n+\n+#ifndef HAVE_STRUCT_IOCB_AIO_RW_FLAGS\n+typedef struct iocb_fallback iocb;\n+#else\n+typedef struct iocb iocb;\n+#endif\n+\n+#endif /* LAPI_AIO_ABI_H__ */\ndiff --git a/runtest/syscalls b/runtest/syscalls\nindex 6ba0227a8..d72fceb5e 100644\n--- a/runtest/syscalls\n+++ b/runtest/syscalls\n@@ -699,6 +699,7 @@ io_setup02 io_setup02\n io_submit01 io_submit01\n io_submit02 io_submit02\n io_submit03 io_submit03\n+io_submit04 io_submit04\n \n keyctl01 keyctl01\n keyctl02 keyctl02\ndiff --git a/testcases/kernel/syscalls/io_submit/.gitignore b/testcases/kernel/syscalls/io_submit/.gitignore\nindex 60b07970a..abe962e1c 100644\n--- a/testcases/kernel/syscalls/io_submit/.gitignore\n+++ b/testcases/kernel/syscalls/io_submit/.gitignore\n@@ -1,3 +1,4 @@\n /io_submit01\n /io_submit02\n /io_submit03\n+/io_submit04\ndiff --git a/testcases/kernel/syscalls/io_submit/io_submit04.c b/testcases/kernel/syscalls/io_submit/io_submit04.c\nnew file mode 100644\nindex 000000000..d68bde909\n--- /dev/null\n+++ b/testcases/kernel/syscalls/io_submit/io_submit04.c\n@@ -0,0 +1,99 @@\n+// SPDX-License-Identifier: GPL-2.0-or-later\n+/*\n+ * Copyright (c) 2025 Wei Gao <wegao@suse.com>\n+ */\n+\n+/*\\\n+ * Test RWF_NOWAIT support in io_submit(), verifying that an\n+ * asynchronous read operation on a blocking resource (empty pipe)\n+ * will cause -EAGAIN. This is done by checking that io_getevents()\n+ * :manpage:`io_getevents(2)` syscall returns immediately and\n+ * io_event.res is equal to -EAGAIN.\n+ */\n+\n+#include \"config.h\"\n+#include \"tst_test.h\"\n+#include \"lapi/syscalls.h\"\n+#include \"lapi/aio_abi.h\"\n+\n+#define BUF_SIZE 100\n+\n+static int fd[2] = {-1, -1};\n+static aio_context_t ctx;\n+static char *buf;\n+static iocb *cb;\n+static iocb **iocbs;\n+\n+static void setup(void)\n+{\n+\tif (tst_syscall(__NR_io_setup, 1, &ctx))\n+\t\ttst_brk(TBROK | TERRNO, \"io_setup failed\");\n+\n+\tSAFE_PIPE(fd);\n+\n+\tcb->aio_fildes = fd[0];\n+\tcb->aio_lio_opcode = IOCB_CMD_PREAD;\n+\tcb->aio_buf = TST_PTR_TO_UINT(buf);\n+\tcb->aio_offset = 0;\n+\tcb->aio_nbytes = BUF_SIZE;\n+\tcb->aio_rw_flags = RWF_NOWAIT;\n+\n+\tiocbs[0] = cb;\n+}\n+\n+static void cleanup(void)\n+{\n+\tif (fd[0] != -1)\n+\t\tSAFE_CLOSE(fd[0]);\n+\n+\tif (fd[1] != -1)\n+\t\tSAFE_CLOSE(fd[1]);\n+\n+\tif (ctx && tst_syscall(__NR_io_destroy, ctx))\n+\t\ttst_brk(TBROK | TERRNO, \"io_destroy() failed\");\n+}\n+\n+static void run(void)\n+{\n+\tstruct io_event evbuf;\n+\tstruct timespec timeout = { .tv_sec = 1 };\n+\tlong nr = 1;\n+\n+\tTEST(tst_syscall(__NR_io_submit, ctx, nr, iocbs));\n+\n+\tif (TST_RET == -1 && TST_ERR == EOPNOTSUPP) {\n+\t\ttst_brk(TCONF, \"RWF_NOWAIT not supported by kernel\");\n+\t} else if (TST_RET != nr) {\n+\t\ttst_brk(TBROK | TTERRNO, \"io_submit() returns %ld, expected %ld\",\n+\t\t\t\tTST_RET, nr);\n+\t}\n+\n+\tTEST(tst_syscall(__NR_io_getevents, ctx, 1, 1, &evbuf, &timeout));\n+\n+\tif (TST_RET != 1) {\n+\t\ttst_res(TFAIL | TTERRNO, \"io_getevents() failed to get 1 event\");\n+\t\treturn;\n+\t}\n+\n+\tif (evbuf.res == -EAGAIN)\n+\t\ttst_res(TPASS, \"io_getevents() returned EAGAIN on read event\");\n+\telse\n+\t\ttst_res(TFAIL, \"io_getevents() returned with %s instead of EAGAIN\",\n+\t\t\tstrerror(-evbuf.res));\n+}\n+\n+static struct tst_test test = {\n+\t.test_all = run,\n+\t.setup = setup,\n+\t.cleanup = cleanup,\n+\t.needs_kconfigs = (const char *[]) {\n+\t\t\"CONFIG_AIO=y\",\n+\t\tNULL\n+\t},\n+\t.bufs = (struct tst_buffers []) {\n+\t\t{&buf, .size = BUF_SIZE},\n+\t\t{&cb, .size = sizeof(iocb)},\n+\t\t{&iocbs, .size = sizeof(iocb *)},\n+\t\t{},\n+\t}\n+};\n","prefixes":["v7"]}