[PATCH libaio 23/28] harness: Handle -ENOTSUP from io_submit() with RWF_NOWAIT
authorGuillem Jover <guillem@hadrons.org>
Sat, 20 Jul 2019 19:21:02 +0000 (21:21 +0200)
committerPeter Michael Green <plugwash@raspbian.org>
Mon, 15 Nov 2021 00:13:31 +0000 (00:13 +0000)
On filesystems such as tmpfs the syscall might return -ENOTSUP instead
of EINVAL when it does not support the RWF_NOWAIT flag.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
[JEM: skip the test instead of returning success]
[JEM: make the error message differentiate between kernel and fs support]
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Gbp-Pq: Topic upstream
Gbp-Pq: Name 0023-harness-Handle-ENOTSUP-from-io_submit-with-RWF_NOWAI.patch

harness/cases/21.t

index ba988ed72320cb0cb8d9187977a1f2097ea5a104..4164c02386c9ea25a1b8cc46f5529563474b51ba 100644 (file)
@@ -108,13 +108,15 @@ test_main()
        ret = io_submit(ctx, 1, &iocbp);
 
        /*
-        * io_submit will return -EINVAL if RWF_NOWAIT is not supported.
+        * io_submit will return -EINVAL if RWF_NOWAIT is not supported by
+        * the kernel, and EOPNOTSUPP if it's not supported by the fs.
         */
        if (ret != 1) {
-               if (ret == -EINVAL) {
-                       fprintf(stderr, "RWF_NOWAIT not supported by kernel.\n");
-                       /* just return success */
-                       return 0;
+               if (ret == -EINVAL || ret == -ENOTSUP) {
+                       fprintf(stderr, "RWF_NOWAIT not supported by %s.\n",
+                               ret == -EINVAL ? "kernel" : "file system");
+                       /* skip this test */
+                       return 3;
                }
                errno = -ret;
                perror("io_submit");