]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commit
fstests: generic/741: make cleanup to handle test failure properly v2025.06.08
authorQu Wenruo <wqu@suse.com>
Wed, 4 Jun 2025 23:55:24 +0000 (09:25 +0930)
committerZorro Lang <zlang@kernel.org>
Sun, 8 Jun 2025 13:48:09 +0000 (21:48 +0800)
commitb3da4865e80d920158906b7a138081f8921545c6
treea6d352896e7d42209755c83820d45fd448bab7dc
parent3563fda0140f8512e15578eb975da15d0fa04052
fstests: generic/741: make cleanup to handle test failure properly

[BUG]
When I was tinkering the bdev open holder parameter, it caused a bug
that it no longer rejects mounting the underlying device of a
device-mapper.

And the test case properly detects the regression:

generic/741 1s ... umount: /mnt/test: target is busy.
_check_btrfs_filesystem: filesystem on /dev/mapper/test-test is inconsistent
(see /home/adam/xfstests/results//generic/741.full for details)
Trying to repair broken TEST_DEV file system
_check_btrfs_filesystem: filesystem on /dev/mapper/test-scratch1 is inconsistent
(see /home/adam/xfstests/results//generic/741.full for details)
- output mismatch (see /home/adam/xfstests/results//generic/741.out.bad)
    --- tests/generic/741.out 2024-04-06 08:10:44.773333344 +1030
    +++ /home/adam/xfstests/results//generic/741.out.bad 2025-06-05 09:18:03.675049206 +0930
    @@ -1,3 +1,2 @@
     QA output created by 741
    -mount: TEST_DIR/extra_mnt: SCRATCH_DEV already mounted or mount point busy
    -mount: TEST_DIR/extra_mnt: SCRATCH_DEV already mounted or mount point busy
    +rm: cannot remove '/mnt/test/extra_mnt': Device or resource busy
    ...
    (Run 'diff -u /home/adam/xfstests/tests/generic/741.out /home/adam/xfstests/results//generic/741.out.bad'  to see the entire diff)

The problem is, all later test will fail, because the $SCRATCH_DEV is
still mounted at $extra_mnt:

 TEST_DEV=/dev/mapper/test-test is mounted but not on TEST_DIR=/mnt/test - aborting
 Already mounted result:
 /dev/mapper/test-test /mnt/test /dev/mapper/test-test /mnt/test

[CAUSE]
The test case itself is doing two expected-to-fail mounts, but the
cleanup function is only doing unmount once, if the mount succeeded
unexpectedly, the $SCRATCH_DEV will be mounted at $extra_mnt forever.

[ENHANCEMENT]
To avoid screwing up later test cases, do the $extra_mnt cleanup twice
to handle the unexpected mount success.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/741