src/seek_sanity_test: skip test20 if file's too big
authorLuis Henriques <lhenriques@suse.com>
Mon, 27 Aug 2018 13:12:11 +0000 (14:12 +0100)
committerEryu Guan <guaneryu@gmail.com>
Wed, 29 Aug 2018 14:44:48 +0000 (22:44 +0800)
Since the allocation size can be quite big for some filesystems
(4194304 for cephfs), the pwrite operation in test20 may fail with
EFBIG.  Skip this test if that's the case.

Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
src/seek_sanity_test.c

index e5aab239771d685b1d0380aa7703ccde83317465..e9938d1b1a23a548731346506f9528f46e4da244 100644 (file)
@@ -280,8 +280,17 @@ static int test20(int fd, int testnum)
        /* Magic size in the middle of ext[23] triple indirect tree */
        filsz = (12 + bufsz / 4 + 8 * bufsz / 4 * bufsz / 4 + 2 * bufsz / 4 + 5) * bufsz;
        ret = do_pwrite(fd, buf, bufsz, filsz - bufsz);
-       if (ret)
+       if (ret) {
+               /*
+                * Report success. Filesystem just cannot handle so large
+                * offsets and correctly reports it.
+                */
+               if (errno == EFBIG) {
+                       fprintf(stdout, "Test skipped as fs doesn't support so large files.\n");
+                       ret = 0;
+               }
                goto out;
+       }
 
        /* Offset inside ext[23] indirect block */
        ret += do_lseek(testnum, 1, fd, filsz, SEEK_DATA, 14 * bufsz, filsz - bufsz);