]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commit
fstests: cleanup old files to respect mount options needing new inodes
authorQu Wenruo <wqu@suse.com>
Thu, 28 May 2026 11:16:59 +0000 (20:46 +0930)
committerZorro Lang <zlang@kernel.org>
Fri, 29 May 2026 09:13:01 +0000 (17:13 +0800)
commit239cc1d598663b849b5da29c5f9d0382ec8eb442
tree58453dfec87bb493cd1a7c51994f005754401bd4
parent1418baaef1faa80d8f2203a2e8cbb36b86afb322
fstests: cleanup old files to respect mount options needing new inodes

[BUG]
Test case generic/362 and generic/365 will fail with nodatasum, but
that's only when TEST_DEV is newly formatted.

 FSTYP         -- btrfs
 PLATFORM      -- Linux/x86_64 btrfs-vm 7.1.0-rc4-custom+ #381 SMP PREEMPT_DYNAMIC Tue May 26 10:47:14 ACST 2026
 MKFS_OPTIONS  -- -O bgt -K /dev/mapper/test-scratch1
 MOUNT_OPTIONS -- -o nodatasum /dev/mapper/test-scratch1 /mnt/scratch

  generic/362  0s ... - output mismatch (see /home/adam/xfstests/results//generic/362.out.bad)
    --- tests/generic/362.out 2024-08-24 15:31:37.200000000 +0930
    +++ /home/adam/xfstests/results//generic/362.out.bad 2026-05-28 16:18:33.866141979 +0930
    @@ -1,2 +1,3 @@
     QA output created by 362
    +First write failed: Input/output error
     Silence is golden
    ...
    (Run 'diff -u /home/adam/xfstests/tests/generic/362.out /home/adam/xfstests/results//generic/362.out.bad'  to see the entire diff)

  generic/364  11s ... - output mismatch (see /home/adam/xfstests/results//generic/364.out.bad)
    --- tests/generic/364.out 2024-09-30 09:09:51.216666681 +0930
    +++ /home/adam/xfstests/results//generic/364.out.bad 2026-05-28 16:18:34.318532257 +0930
    @@ -1,2 +1,3 @@
     QA output created by 364
    +Fsync failed: Input/output error
     Silence is golden
    ...
    (Run 'diff -u /home/adam/xfstests/tests/generic/364.out /home/adam/xfstests/results//generic/364.out.bad'  to see the entire diff)

But if one has formated TEST_DEV, run test with default mount option,
then change the mount option to "nodatasum", the test will not fail
anymore:

 FSTYP         -- btrfs
 PLATFORM      -- Linux/x86_64 btrfs-vm 7.1.0-rc4-custom+ #381 SMP PREEMPT_DYNAMIC Tue May 26 10:47:14 ACST 2026
 MKFS_OPTIONS  -- -O bgt -K /dev/mapper/test-scratch1
 MOUNT_OPTIONS -- /dev/mapper/test-scratch1 /mnt/scratch

 generic/362  0s ...  1s
 generic/364  11s ...  10s
 Ran: generic/362 generic/364
 Passed all 2 tests

 FSTYP         -- btrfs
 PLATFORM      -- Linux/x86_64 btrfs-vm 7.1.0-rc4-custom+ #381 SMP PREEMPT_DYNAMIC Tue May 26 10:47:14 ACST 2026
 MKFS_OPTIONS  -- -O bgt -K /dev/mapper/test-scratch1
 MOUNT_OPTIONS -- -o nodatasum /dev/mapper/test-scratch1 /mnt/scratch

 generic/362  1s ...  0s
 generic/364  10s ...  11s
 Ran: generic/362 generic/364
 Passed all 2 tests

[CAUSE]
Btrfs' nodatasum mount option only affects new files, but the test cases
are using TEST_DEV, and never delete the target files
"$TEST_DIR/dio-append-buf-fault" for generic/362 and
"$TEST_DIR/dio-write-fsync-same-fd" for generic/364.

So if the files are created with default mount options, then all later
"nodatasum" mount options will not affect those files, thus hide the test
failure.

[FIX]
For all test cases utilizing "$here/src/dio*", add a _cleanup()
function, to remove target files, so that for mount options that only
affect new inodes, the mount options will be respected, and expose
failures.

Now generic/36[24] will properly fail for "nodatasum" mount option on
btrfs.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Anand Jain <asj@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/362
tests/generic/364
tests/generic/418
tests/generic/708