[LTP] [PATCH 1/1] aiocp.c: TCONF on O_DIRECT on tmpfs

Cyril Hrubis chrubis@suse.cz
Mon Dec 19 13:07:21 CET 2022


Hi!
> > hm, it looks like it requires to skip tmpfs, as all tests TCONF:
> > aiocp.c:231: TINFO: Maximum AIO blocks: 65536
> > tst_device.c:541: TINFO: Use BTRFS specific strategy
> > tst_device.c:559: TBROK: BTRFS ioctl failed. Is . on a tmpfs?: ENOTTY (25)
> 
> > I check if it'd work without
> > e1b1ae66b2 ("tst_find_backing_dev: Get dev name from /sys/dev/block/*/uevent")
> 
> TMPDIR=/home/foo ./aiocp -b 1k -n 1 -f DIRECT # xfs
> tst_test.c:1558: TINFO: Timeout per run is 0h 30m 30s
> tst_test.c:1310: TINFO: xfs is supported by the test
> aiocp.c:231: TINFO: Maximum AIO blocks: 65536
> tst_device.c:585: TINFO: Use uevent strategy
> aiocp.c:267: TINFO: Fill srcfile.bin with random data
> aiocp.c:84: TBROK: write(3,0x7ffeccb9da00,60274) failed: EINVAL (22)
> 
> TMPDIR=/var/tmp ./aiocp -b 1k -n 1 -f DIRECT # ext4
> tst_test.c:1558: TINFO: Timeout per run is 0h 30m 30s
> tst_test.c:1310: TINFO: ext2/ext3/ext4 is supported by the test
> aiocp.c:231: TINFO: Maximum AIO blocks: 65536
> tst_device.c:585: TINFO: Use uevent strategy
> aiocp.c:267: TINFO: Fill srcfile.bin with random data
> aiocp.c:84: TBROK: write(3,0x7ffda9e14120,50530) failed: EINVAL (22)

Ah, I suppose that this fails because we are wrongly passing the
srcflags to the open() that fills the source file with random data and
we end up passing O_DIRECT to the function that does not aling the
buffers and sizes at all.

Does this fix it?

diff --git a/testcases/kernel/io/ltp-aiodio/aiocp.c b/testcases/kernel/io/ltp-aiodio/aiocp.c
index ee893ab11..a75da6a0c 100644
--- a/testcases/kernel/io/ltp-aiodio/aiocp.c
+++ b/testcases/kernel/io/ltp-aiodio/aiocp.c
@@ -263,7 +263,7 @@ static void setup(void)

        tst_res(TINFO, "Fill %s with random data", srcname);

-       srcfd = SAFE_OPEN(srcname, srcflags | O_RDWR | O_CREAT, 0666);
+       srcfd = SAFE_OPEN(srcname, O_WRONLY | O_CREAT, 0666);
        fill_with_rand_data(srcfd, filesize);
        SAFE_CLOSE(srcfd);
 }


-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list