]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commit
btrfs/220: fix the test failure due to new default mount option
authorQu Wenruo <wqu@suse.com>
Fri, 9 Dec 2022 06:05:10 +0000 (14:05 +0800)
committerZorro Lang <zlang@kernel.org>
Sun, 25 Dec 2022 13:21:02 +0000 (21:21 +0800)
commitdaa1c02369c869bfa85c0ad149020c52b4480b09
tree579fce1122b79211dfc63cf90998bdd1bca1fbd5
parentd401145dc1c940dd8ce3016d9fd2c7e76c23b057
btrfs/220: fix the test failure due to new default mount option

[BUG]
The latest misc-next tree will make test case btrfs/220 fail with the
following error messages:

btrfs/220 15s ... - output mismatch (see ~/xfstests/results//btrfs/220.out.bad)
    --- tests/btrfs/220.out 2022-05-11 09:55:30.749999997 +0800
    +++ ~/xfstests/results//btrfs/220.out.bad 2022-12-09 13:57:23.706666671 +0800
    @@ -1,2 +1,5 @@
     QA output created by 220
    +Unexepcted mount options, checking for 'rw,relatime,discard=async,space_cache=v2,subvolid=5,subvol=/' in 'rw,relatime,space_cache=v2,subvolid=5,subvol=/' using 'nodiscard'
    +Unexepcted mount options, checking for 'rw,relatime,discard=async,space_cache=v2,subvolid=5,subvol=/' in 'rw,relatime,space_cache=v2,subvolid=5,subvol=/' using 'nodiscard'
    +Unexepcted mount options, checking for 'rw,relatime,discard=async,space_cache=v2,subvolid=5,subvol=/' in 'rw,relatime,space_cache=v2,subvolid=5,subvol=/' using 'nodiscard'
     Silence is golden
    ...
    (Run 'diff -u ~/xfstests/tests/btrfs/220.out ~/xfstests/results//btrfs/220.out.bad'  to see the entire diff)
Ran: btrfs/220
Failures: btrfs/220
Failed 1 of 1 tests

[CAUSE]
Since patch "btrfs: auto enable discard=async when possible", which is
already in the maintainer's tree for next merge window, btrfs will
automatically enable asynchronous discard for devices which supports
discard.

This makes our $DEFAULT_OPTS to have "discard=async" in it.

While for "nodiscard" mount option, we will completely disable all
discard, causing the above mismatch.

[FIX]
Fix it by introducing $DEFAULT_NODISCARD_OPTS specifically for
"nodiscard" mount option.

If async discard is not enabled by default, $DEFAULT_NODISCARD_OPTS will
be the same as $DEFAULT_OPTS, thus everything would work as usual.

If async discard is enabled by default, $DEFAULT_NODISCARD_OPTS will
have that removed, so for "nodiscard" we can use $DEFAULT_NODISCARD_OPTS
as expected mount options.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/btrfs/220