]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
aio-dio-write-verify: check for the IO errors
authorNaohiro Aota <naohiro.aota@wdc.com>
Tue, 22 Aug 2023 07:28:50 +0000 (16:28 +0900)
committerZorro Lang <zlang@kernel.org>
Fri, 1 Sep 2023 19:27:32 +0000 (03:27 +0800)
The async write IOs can return some errors, which may lead to a short read or
corruption in io_verify() stage. Catch an error early to identify the root
cause easily.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
src/aio-dio-regress/aio-dio-write-verify.c

index 302b8fe4a09605cc7c80d8538352a3bdbaa8fd12..90e41b391289587a94efa0489f331d859fa09bf1 100644 (file)
@@ -238,6 +238,16 @@ static int io_write(int fd, int num_events)
                return 1;
        }
 
+       for (i = 0; i < num_events; i++) {
+               int err = (int)evs[i].res;
+
+               if (err < 0) {
+                       fprintf(stderr, "error %s with event %d\n",
+                               strerror(err), i);
+                       return 1;
+               }
+       }
+
        /* Try to destroy at here, not necessary, so don't check result */
        io_destroy(ctx);