]> www.infradead.org Git - users/hch/xfstests-dev.git/log
users/hch/xfstests-dev.git
2 years agoxfs: test xfs_copy doesn't do cached read before libxfs_mount master v2022.07.03
Darrick J. Wong [Thu, 30 Jun 2022 00:48:14 +0000 (17:48 -0700)]
xfs: test xfs_copy doesn't do cached read before libxfs_mount

This is a regression test for an xfs_copy fix that ensures that it
doesn't perform a cached read of an XFS filesystem prior to initializing
libxfs, since the xfs_mount (and hence the buffer cache) isn't set up
yet.

[zlang: change the supported fs from generic to xfs]

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs: test mkfs.xfs sizing of internal logs that
Darrick J. Wong [Tue, 28 Jun 2022 20:21:34 +0000 (13:21 -0700)]
xfs: test mkfs.xfs sizing of internal logs that

This is a regression test that exercises the mkfs.xfs code that creates
log sizes that are very close to the AG size when stripe units are in
play and/or when the log is forced to be in AG 0.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/166: fix golden output failures when multipage folios enabled
Darrick J. Wong [Tue, 28 Jun 2022 20:22:02 +0000 (13:22 -0700)]
xfs/166: fix golden output failures when multipage folios enabled

Beginning with 5.18, some filesystems support creating large folios for
the page cache.  A system with 64k pages can create 256k folios, which
means that with the old file size of 1M, the last half of the file is
completely converted from unwritten to written by page_mkwrite.  The
test encodes a translated version of the xfs_bmap output in the golden
output, which means that the test now fails on 64k pages.  Fixing the
64k page case by increasing the file size to 2MB broke fsdax because
fsdax uses 2MB PMDs, hence 12MB.

Increase the size to prevent this from happening.  This may require
further revision if folios get larger or fsdax starts supporting PMDs
that are larger than 2MB.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/109: handle larger minimum filesystem size
Darrick J. Wong [Tue, 28 Jun 2022 20:21:51 +0000 (13:21 -0700)]
xfs/109: handle larger minimum filesystem size

mkfs will soon refuse to format a filesystem smaller than 300MB, so
increase the size of the filesystem to keep this test scenario
realistic.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agocheck: document mkfs.xfs reliance on fstests exports
Darrick J. Wong [Tue, 28 Jun 2022 20:21:45 +0000 (13:21 -0700)]
check: document mkfs.xfs reliance on fstests exports

There are a number of fstests that employ special (and now unsupported)
XFS filesystem configurations to perform testing in a controlled
environment.  The presence of the QA_CHECK_FS and MSGVERB variables are
used by mkfs.xfs to detect that it's running inside fstests, which
enables the unsupported configurations.  Nobody else should be using
filesystems with tiny logs, non-redundant superblocks, or smaller than
the (new) minimum supported size.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoseek_sanity_test: fix allocation unit detection on XFS realtime
Darrick J. Wong [Tue, 28 Jun 2022 20:21:23 +0000 (13:21 -0700)]
seek_sanity_test: fix allocation unit detection on XFS realtime

The seek sanity test tries to figure out a file space allocation unit by
calling stat and then using an iterative SEEK_DATA method to try to
detect a smaller blocksize based on SEEK_DATA's consultation of the
filesystem's internal block mapping.  This was put in (AFAICT) because
XFS' stat implementation returns max(filesystem blocksize, PAGESIZE) for
most regular files.

Unfortunately, for a realtime file with an extent size larger than a
single filesystem block this doesn't work at all because block mappings
still work at filesystem block granularity, but allocation units do not.
To fix this, detect the specific case where st_blksize != PAGE_SIZE and
trust the fstat results.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoext4: create file systems with the encrypt feature as necessary
Theodore Ts'o [Thu, 30 Jun 2022 14:46:37 +0000 (10:46 -0400)]
ext4: create file systems with the encrypt feature as necessary

The linux kernel commit 5f41fdaea63d ("ext4: only allow
test_dummy_encryption when supported") the kernel will reject mounts
with the test_dummy_encryption option if the ext4 file system does not
have the encrypt feature enabled.

There are a handful of tests (ext4/003, ext4/035, ext4/306, and
generic/260) which will format the scratch file system using a
hard-coded set of mkfs.ext4 parameters ignoring the MKFS_OPTION that
is set by the file system test config.

For file system configs which includes test_dummy_encryption in
MOUNT_OPTIONS and "-O encrypt" in MKFS_OPTIONS, we need to test for
test_dummy_encryption and force the hard-coded mkfs options to enable
the encrypt feature.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoext4/035: skip this test if the scratch device does not support 1k block sizes
Theodore Ts'o [Thu, 30 Jun 2022 14:46:36 +0000 (10:46 -0400)]
ext4/035: skip this test if the scratch device does not support 1k block sizes

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoext4/055: skip test if dax mount option is used
Theodore Ts'o [Thu, 30 Jun 2022 14:46:35 +0000 (10:46 -0400)]
ext4/055: skip test if dax mount option is used

This test creates a 1k block file system with the quota feature
enabled.   As such, it is incompatible with DAX.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoext4/054: skip test if the dax mount option is enabled
Theodore Ts'o [Thu, 30 Jun 2022 14:46:34 +0000 (10:46 -0400)]
ext4/054: skip test if the dax mount option is enabled

The ext4/054 test explicitly creates a file system with a 1k
blocksize.  This can't possibly work on if the dax mount option is
enabled, so change ext4/054 to use _scratch_mkfs_blocksized, and and a
check to _scratch_mkfs_blocksized to _notrun the test if the block
size is less than the page size.

Also remove an unnecessary _require_test declaration since this test
does not use the test device.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoext4/045: _require_dumpe2fs doesn't take any arguments so remove them
Theodore Ts'o [Thu, 30 Jun 2022 14:46:33 +0000 (10:46 -0400)]
ext4/045: _require_dumpe2fs doesn't take any arguments so remove them

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoext4/044: skip test if the file system does not have a journal
Theodore Ts'o [Thu, 30 Jun 2022 14:46:32 +0000 (10:46 -0400)]
ext4/044: skip test if the file system does not have a journal

This test mounts the file system using "mount -t ext3"; if the file
system config creates the file system without the jbd2 journal, the
"mount -t ext3" will fail.  So skip this test in that case.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoext4/050: support indirect as well as extent mapped journals
Theodore Ts'o [Thu, 30 Jun 2022 14:46:31 +0000 (10:46 -0400)]
ext4/050: support indirect as well as extent mapped journals

Simplify the test and fix ext4/050 failures when running ext4 without
extents enabled (e.g., in ext3 emulation mode).

Instead of relying on parsing debugfs output's (which varies depending
on whether the journal inode is extent mapped or indirect block
mapped), use debugfs's "cat" command to get the contents of the
journal.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoceph/005: verify correct statfs behaviour with quotas
Luís Henriques [Mon, 27 Jun 2022 10:26:31 +0000 (11:26 +0100)]
ceph/005: verify correct statfs behaviour with quotas

When using a directory with 'max_bytes' quota as a base for a mount,
statfs shall use that 'max_bytes' value as the total disk size.  That
value shall be used even when using subdirectory as base for the mount.

A bug was found where, when this subdirectory also had a 'max_files'
quota, the real filesystem size would be returned instead of the parent
'max_bytes' quota value.  This test case verifies this bug is fixed.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs: test read repair on a corrupted compressed extent
Christoph Hellwig [Wed, 22 Jun 2022 04:58:44 +0000 (06:58 +0200)]
btrfs: test read repair on a corrupted compressed extent

Exercise read repair on a corrupted compressed sector.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs: test checker pattern corruption on raid10
Christoph Hellwig [Wed, 22 Jun 2022 04:58:43 +0000 (06:58 +0200)]
btrfs: test checker pattern corruption on raid10

Check read repair for the case where the corruption is spread over
the different legs of a raid10 set.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs; add a test for impossible repair cases
Christoph Hellwig [Wed, 22 Jun 2022 04:58:42 +0000 (06:58 +0200)]
btrfs; add a test for impossible repair cases

Verify that a repair attempt that can't succeed because all copies are
bad returns a proper I/O error and doesn't cause any deadlocks.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs: fix the_btrfs_get_physical invocation in btrfs-map-logical
Christoph Hellwig [Wed, 22 Jun 2022 04:58:41 +0000 (06:58 +0200)]
btrfs: fix the_btrfs_get_physical invocation in btrfs-map-logical

The -b flag without an argument is not supported, so remove it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/{422,517}: kill background jobs on test termination v2022.06.26
Amir Goldstein [Tue, 21 Jun 2022 17:37:29 +0000 (20:37 +0300)]
xfs/{422,517}: kill background jobs on test termination

Those tests failed to cleanup background jobs properly after test
is interrupted and even sometimes when it completed succefully.

xfs/517 would sometime fails randomally with this false positive error:
     QA output created by 517
     Format and populate
     Concurrent fsmap and freeze
    +Terminated
     Test done

The tests have several background sub-shells that spawn short lived
programs in a loop.  By killing the spawned programs using killall,
killall could find no process to kill and the sub-shell loop could still
spawn another process that is not going to be killed and in the worst
case, the freeze_loop() could spawn the xfs_io "freeze" command after
test has thawn the fs before exit, which leaves the fs frozen after the
test.

The "Terminated" output is emitted by the sub-shell when killing the
programs that it has spawned when the loop did not finish before test
timeout.  By killing the sub-shell and not the spawned programs, we
avoid the false positive "Terminated" error.

Use a helper to perform this cleanup dance:
First kill and wait the freeze_loop so it won't try to freeze fs again
Then make sure fs is not frozen.
Then kill and wait for the rest of the sub-shells, because
if fs is frozen a killed writer process will never exit.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agofstests: unfreeze fs on cleanup routines
Amir Goldstein [Tue, 21 Jun 2022 17:37:28 +0000 (20:37 +0300)]
fstests: unfreeze fs on cleanup routines

Many of tests that freeze fs do not make sure that fs is unfrozen on
test termination.

Some tests also need to kill and wait for writer processes after
unfreezing the fs.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agofstests: add missing _require_freeze() to tests
Amir Goldstein [Tue, 21 Jun 2022 17:37:27 +0000 (20:37 +0300)]
fstests: add missing _require_freeze() to tests

And add a few tests that use freeze to the freeze group

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoext4/053: test changing test_dummy_encryption on remount
Eric Biggers [Thu, 23 Jun 2022 18:41:13 +0000 (11:41 -0700)]
ext4/053: test changing test_dummy_encryption on remount

The test_dummy_encryption mount option isn't supposed to be settable or
changeable via a remount, so add test cases for this.  This is a
regression test for a bug that was introduced in Linux v5.17 and fixed
in v5.19-rc3 by commit 85456054e10b ("ext4: fix up test_dummy_encryption
handling for new mount API").

Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/122: escape %zu in printf with %% not \\%
Eric Sandeen [Mon, 20 Jun 2022 21:43:31 +0000 (16:43 -0500)]
xfs/122: escape %zu in printf with %% not \\%

The standard way to escape % in a printf is with %%; although \\%zu
seems to have worked in awk until recently, an upgrade on Fedora 36
has started failing:

awk: cmd. line:1: (FILENAME=- FNR=1) fatal: not enough arguments to satisfy format string
        'printf("sizeof(%s) = \%zu\n", sizeof(%s));
    '
                                              ^ ran out for this one
Switching the escape to "%%" fixes this for me, and also works
on my very old RHEL7 mcahine.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agocheck: remove err and first_test variables
David Disseldorp [Mon, 20 Jun 2022 19:29:34 +0000 (21:29 +0200)]
check: remove err and first_test variables

tc_status can be used for both of these.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agocheck: use arrays instead of separate n_ counters
David Disseldorp [Mon, 20 Jun 2022 19:29:33 +0000 (21:29 +0200)]
check: use arrays instead of separate n_ counters

The separate n_try, n_bad and n_notrun counters are unnecessary when
the corresponding lists are switched to bash arrays.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoreport: fix xunit tests count
David Disseldorp [Mon, 20 Jun 2022 19:29:32 +0000 (21:29 +0200)]
report: fix xunit tests count

The xunit "section report" provides a tests attribute, which according
to https://llg.cubic.org/docs/junit/ represents:
tests=""     <!-- The total number of tests in the suite, required. -->

The current value is generated as a sum of the $n_try and $n_notrun
counters. This is incorrect as the $n_try counter already includes tests
which are run but complete with _notrun.
One special case exists for $showme (check -n), where $n_try remains
zero, so $n_notrun can be used as-is.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoreport: drop unused _xunit_make_section_report parameter
David Disseldorp [Mon, 20 Jun 2022 19:29:31 +0000 (21:29 +0200)]
report: drop unused _xunit_make_section_report parameter

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agocheck: simplify check.time parsing
David Disseldorp [Mon, 20 Jun 2022 19:29:30 +0000 (21:29 +0200)]
check: simplify check.time parsing

There's no need to use grep and awk when the latter can do all that's
needed, including the pretty printing.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agocheck: avoid FSTYP=<fstyp parameter> repetition
David Disseldorp [Mon, 20 Jun 2022 19:29:29 +0000 (21:29 +0200)]
check: avoid FSTYP=<fstyp parameter> repetition

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agogeneric/486: adjust the max xattr size
Luís Henriques [Mon, 13 Jun 2022 11:31:42 +0000 (12:31 +0100)]
generic/486: adjust the max xattr size

CephFS doesn't have a maximum xattr size.  Instead, it imposes a maximum
size for the full set of xattrs names+values, which by default is 64K.  And
since it reports 4M as the blocksize (the default ceph object size),
generic/486 will fail in ceph because the XATTR_SIZE_MAX value can't be used
in attr_replace_test.

The fix is to add a new argument to the test so that the max size can be
passed in instead of trying to auto-probe a value for it.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agogeneric/020: adjust max_attrval_size for ceph
Luís Henriques [Mon, 13 Jun 2022 11:31:41 +0000 (12:31 +0100)]
generic/020: adjust max_attrval_size for ceph

CephFS doesn't have a maximum xattr size.  Instead, it imposes a maximum
size for the full set of xattrs names+values, which by default is 64K.

This patch fixes the max_attrval_size for ceph so that it is takes into
account any already existing attrs in the file.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs: Verify correctness of upgrading an fs to support large extent counters v2022.06.12
Chandan Babu R [Sat, 11 Jun 2022 11:10:37 +0000 (16:40 +0530)]
xfs: Verify correctness of upgrading an fs to support large extent counters

This commit adds a test to verify upgrade of an existing V5 filesystem to
support large extent counters.

Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs: Verify that the correct inode extent counters are updated with/without nrext64
Chandan Babu R [Sat, 11 Jun 2022 11:10:36 +0000 (16:40 +0530)]
xfs: Verify that the correct inode extent counters are updated with/without nrext64

This commit adds a new test to verify if the correct inode extent counter
fields are updated with/without nrext64 mkfs option.

Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agocommon/xfs: Add helper to check if nrext64 option is supported
Chandan Babu R [Sat, 11 Jun 2022 11:10:35 +0000 (16:40 +0530)]
common/xfs: Add helper to check if nrext64 option is supported

This commit adds a new helper to allow tests to check if xfsprogs and xfs
kernel module support nrext64 option.

Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/270: Fix ro mount failure when nrext64 option is enabled
Chandan Babu R [Sat, 11 Jun 2022 11:10:34 +0000 (16:40 +0530)]
xfs/270: Fix ro mount failure when nrext64 option is enabled

With nrext64 option enabled at run time, the read-only mount performed by the
test fails because,
1. mkfs.xfs would have calculated log size based on reflink being enabled.
2. Clearing the reflink ro compat bit causes log size calculations to yield a
   different value.
3. In the case where nrext64 is enabled, this causes attr reservation to be
   the largest among all the transaction reservations.
4. This ends up causing XFS to require a larger ondisk log size than that
   which is available.

This commit fixes the problem by setting features_ro_compat to the value
obtained by the bitwise-OR of features_ro_compat field with 2^31.

This commit includes changes suggested by Dave Chinner to replace bashisms
with invocations to inline awk scripts.

Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs/220: zoned: skip nodatacow mount option for zoned btrfs
Naohiro Aota [Tue, 7 Jun 2022 08:06:35 +0000 (17:06 +0900)]
btrfs/220: zoned: skip nodatacow mount option for zoned btrfs

The nodatacow mount option is not allowed on zoned btrfs and failing the
test. Skip the cases for zoned btrfs.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agocommon/filter: filter out extra mount error output
Zorro Lang [Fri, 27 May 2022 12:11:15 +0000 (20:11 +0800)]
common/filter: filter out extra mount error output

The lastest mount command (from util-linux) merged below commit:
  79534c0d7e0f ("mount: add hint about dmesg(8) to error messages")
which brought in a new error output when mount fails, no matter
ro/rw/busy mount fails.

That cause some cases (e.g. xfs/005) fail as:
  mount: Structure needs cleaning
         dmesg(1) may have more information after failed mount system call

More failed cases like generic/050, ext4/002, xfs/154, xfs/158 etc.
Especially xfs/154 and xfs/158, need to change their _filter_scratch
to _filter_error_mount.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>
2 years agoxfs: corrupted xattr should not block removexattr
Zorro Lang [Fri, 3 Jun 2022 08:24:57 +0000 (16:24 +0800)]
xfs: corrupted xattr should not block removexattr

After we corrupted an attr leaf block (under node block), getxattr
might hit EFSCORRUPTED in xfs_attr_node_get when it does
xfs_attr_node_hasname. A known bug cause xfs_attr_node_get won't do
xfs_buf_trans release job, then a subsequent removexattr will hang.

This case covers a1de97fe296c ("xfs: Fix the free logic of state in
xfs_attr_node_hasname")

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
2 years agoxfs/189: systemd monitoring of /etc/fstab sucks v2022.06.05
Dave Chinner [Fri, 3 Jun 2022 01:54:13 +0000 (11:54 +1000)]
xfs/189: systemd monitoring of /etc/fstab sucks

On a recently upgraded system, xfs/189 still works just fine, but
every test run after it now gets spammed from mount/systemd
like so:

xfs/189 [not run] noattr2 mount option not supported on /dev/vdc
xfs/190 1s ... mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
 1s
xfs/192 3s ... mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
 2s
xfs/193 2s ... mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
 2s
xfs/194 1s ... mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.

This is because xfs/189 modifies /etc/fstab during the test, then
restores it to it's original condition so there's nothing to update.
However, systemd is sees that the mtime of /etc/fstab has changed,
and assumes they sky has fallen and so everything must be reloaded
from scratch to silence the unnecessary "hint".

We can avoid this clumsiness by capturing the mtime of /etc/fstab
before we modify it, and restore it afterwards and that means
systemd doesn't even notice that we've being playing around with
/etc/fstab.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/167: adjust runtime with TIME_FACTOR
Dave Chinner [Thu, 2 Jun 2022 00:31:25 +0000 (10:31 +1000)]
xfs/167: adjust runtime with TIME_FACTOR

xfs/167 takes between 6 and 10 minutes to run on my SSD based test
machines. It's running 50 loops of a unwritten extent conversion
test program whilst running a heavy fsstress workload in the
background. This does not need to run for 10 minutes on every auto
group regression test run. Shorten it to loop 5 * TIME_FACTOR
so that normal runtime drops to something sane but can still be
easily ramped up if soak/stress testing is being run.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/070: filter the bad sb magic number error
Dave Chinner [Thu, 2 Jun 2022 00:31:24 +0000 (10:31 +1000)]
xfs/070: filter the bad sb magic number error

Lastest XFS kernel makes the superblock bad magic number error
message more meaningful, and that's being picked up by xfsprogs in
very short order. And, of course, the error is output by xfs_repair,
too, and it's been captured in the golden output of a test. Fix it
by filtering the output back down to the old message.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/538: fix fsstress scaling
Dave Chinner [Thu, 2 Jun 2022 00:31:23 +0000 (10:31 +1000)]
xfs/538: fix fsstress scaling

_scale_fsstress_args() does time/load scaling of parameters. Doing
it also in the test causes exponential scaling instead of linear
scaling as the time/load parameters are meant to do.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agogeneric/038: kill background threads on interrupt
Dave Chinner [Thu, 2 Jun 2022 00:31:22 +0000 (10:31 +1000)]
generic/038: kill background threads on interrupt

When I ctrl-c g/038, it either does nothing or it leaves processes
running in the background. It is not cleaning up it's background
processes correctly, so add kill vectors into the cleanup. Make sure
we only kill in the cleanup trap if the background processes are
running.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agogeneric/081: don't run on DAX capable devices
Dave Chinner [Thu, 2 Jun 2022 00:31:21 +0000 (10:31 +1000)]
generic/081: don't run on DAX capable devices

LVM/DM has conniptions when you try to use snapshots on a device
that has DAX capability. It first sets up the underlying device as a
DAX capable mapping (type 3 or DM_TYPE_DAX_BIO_BASED) but because
snapshots require COW and shared mappings, it isn't supported on DAX
capable devices. Hence creating the snapshot device fails because it
requires a type 1 (DM_TYPE_BIO_BASED) device and DM can't change
types on a loaded mapping.

Hence we get this obscure error message in the log:

device-mapper: ioctl: can't change device type (old=3 vs new=1) after initial table load.

and these obscure, unhelpful error messages from the LVM command
outputs:

  device-mapper: reload ioctl on  (251:0) failed: Invalid argument
  Failed to suspend logical volume vg_081/base_081.
  Device vg_081-base_081-real (251:1) is used by another device.
  Failed to revert logical volume vg_081/base_081.
  Aborting. Manual intervention required.
Failed to create snapshot

How to turn off DAX capability is not documented in dmsetup or LVM
man pages, nor is dax mentioned anywhere in
Documentation/admin/device-mapper/ so I have no idea how to tell
LVM/DM "don't try to enable DAX support!".

As such, if the uderlying block device is dax capable, skip this
test.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoREADME: document _begin_fstests better
Dave Chinner [Thu, 2 Jun 2022 00:31:20 +0000 (10:31 +1000)]
README: document _begin_fstests better

Because how it actually gets used by the fstests infrastructure
has been undocumented and that has impact on how it should be set
up.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agofstests: Add Log Attribute Replay test
Allison Henderson [Fri, 3 Jun 2022 01:41:12 +0000 (11:41 +1000)]
fstests: Add Log Attribute Replay test

This patch adds tests to exercise the log attribute error
inject and log replay. These tests aim to cover cases where attributes
are added, removed, and overwritten in each format (shortform, leaf,
node). Error inject is used to replay these operations from the log.

dchinner: sanitise md5sum input to just attr values.
dchinner: correct md5sums.
dchinner: ensure replace tests use different values so recovery can
          determine the replace was replayed correctly.
dchinner: don't remove corpse in _cleanup - scratch devices don't
  require cleanup, and if the test fails we want to leave
  the broken state for post-mortem analysis.
dchinner: only run on v5 filesystems.

[zlang: restore the old value of /sys/fs/xfs/debug/larp]

Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agogeneric/591: use proper sector size
Zorro Lang [Tue, 31 May 2022 07:45:01 +0000 (15:45 +0800)]
generic/591: use proper sector size

The generic/591 fails if the sector size of TEST_DEV isn't 512:

  splice-test: write: /mnt/test/a: Invalid argument

To fix this issue, this patch help src/splice-test.c to get a specify
sector size from the test case. Then let g/591 give it a proper
sector size which dio aligned.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
2 years agogeneric/591: remove redundant output from golden image
Zorro Lang [Sun, 29 May 2022 08:13:25 +0000 (16:13 +0800)]
generic/591: remove redundant output from golden image

In generic/591.out expects below output:
  concurrent reader with O_DIRECT
  concurrent reader with O_DIRECT     <=== ???
  concurrent reader without O_DIRECT
  concurrent reader without O_DIRECT  <=== ???
  sequential reader with O_DIRECT
  sequential reader without O_DIRECT

The lines marked "???" are unbelievable, due to the src/splice-test.c
only calls printf to output that message once in main function. So
Why splice-test prints that message twice sometimes? It seems related
with the "-r" option, due to the test lines without "-r" option only
print one line each time running.

A stanger thing is this "double output" issue only can be triggered by
running g/591, can't reproduce it by running splice-test manually.

By checking the code of splice-test.c, I found a "fork()" in it, and
it'll be called if the '-r' option is specified. So I suspect the
redundant output come from the child process. By the help of strace
tool, I got:

  10554 execve("/root/git/xfstests/src/splice-test", ["/root/git/xfstests/src/splice-te"..., "-r", "/mnt/test/a"], 0x7ffcabc2c0a8 /* 202 vars */) = 0
  ...
  10554 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f937f5d5a10) = 10555
  ...
  10555 read(4, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"..., 512) = 512
  10555 write(1, "concurrent reader with O_DIRECT\n", 32) = 32
  10555 exit_group(0)                     = ?
  10555 +++ exited with 0 +++
  10554 <... wait4 resumed>NULL, 0, NULL) = 10555
  10554 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=10555, si_uid=0, si_status=0, si_utime=0, si_stime=1} ---
  10554 unlink("/mnt/test/a")             = 0
  10554 write(1, "concurrent reader with O_DIRECT\n", 32) = 32
  10554 exit_group(0)                     = ?
  10554 +++ exited with 0 +++

We can see the "concurrent reader with O_DIRECT\n" be printed by
parent process 10554 and child process 10555 separately.

Due to the stdout redirection that fstests does cause the stream
doesn't refer to a tty anymore, then the stdout become block
buffered, so the '\n' doesn't help to flush that printf message,
and the child print it again.

So use setlinebuf(stdout) to force it line buffered, to avoid the
confused output to be golden image. Then correct the generic/591.out

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
2 years agogeneric/506: call _require_quota before _qmount
Zorro Lang [Sun, 29 May 2022 09:03:36 +0000 (17:03 +0800)]
generic/506: call _require_quota before _qmount

The g/506 fails on some filesystems (e.g. overlay) which doesn't
support prjquota:

  MOUNT_OPTIONS =  -o prjquota
  qmount failed

To avoid this failure, call _require_quota before doing real quota
mount.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
2 years agogeneric/139: require 512 bytes to be the minimum dio size
Zorro Lang [Thu, 2 Jun 2022 05:17:16 +0000 (13:17 +0800)]
generic/139: require 512 bytes to be the minimum dio size

Due to generic/139 tests base on 512 bytes aligned, so skip this test
if the minimum dio write size >512. This patch also change the
common/rc::_require_dio helper, supports a minimum aligned size
argument.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
2 years agocommon/rc: Fix _require_batched_discard to skip test correctly
Liu Yiding [Tue, 31 May 2022 07:12:52 +0000 (15:12 +0800)]
common/rc: Fix _require_batched_discard to skip test correctly

xfstest commit ee264b3f ("common/rc: Modify _require_batched_discard to
improve test coverage") changed the way of determing if discard is
supported by checking whether fstrim output contains "not supported"
keywords.

On RHEL, fstrim output below info when discard is not supported
"fstrim: /mnt/share0/: FITRIM ioctl failed: Function not implemented"

Supplyment unsupported keywords to _require_batched_discard.

Signed-off-by: Liu Yiding <liuyd.fnst@fujitsu.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoext4/053: update the test_dummy_encryption tests
Eric Biggers [Mon, 30 May 2022 17:30:44 +0000 (10:30 -0700)]
ext4/053: update the test_dummy_encryption tests

Kernel commit 5f41fdaea63d ("ext4: only allow test_dummy_encryption when
supported") tightened the requirements on when the test_dummy_encryption
mount option is accepted.  Update ext4/053 accordingly.

Move the test cases to later in the file to group them with the other
test cases that use do_mkfs to add custom mkfs options instead of using
the "default" filesystem that the test creates at the beginning.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agogeneric: adjust strict SPO recovery testcases for f2fs
Chao Yu [Sat, 21 May 2022 03:16:21 +0000 (11:16 +0800)]
generic: adjust strict SPO recovery testcases for f2fs

Testcases like generic 342/502/526/527 expect that filesystems will
recover all related metadata changes to the file which was fsynced
before sudden power off.

This patch adjusts to use "fsync_mode=strict" mountoption for f2fs
to pass these testcases.

Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs: test direct I/O read repair with interleaved corrupted sectors v2022.05.29
Christoph Hellwig [Fri, 27 May 2022 08:19:15 +0000 (10:19 +0200)]
btrfs: test direct I/O read repair with interleaved corrupted sectors

Test that repair handles the case where it needs to read from more than
a single mirror on the raid1c3 profile and needs to take turns over the
mirrors to recover data for the whole read.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs: test buffered I/O read repair with interleaved corrupted sectors
Christoph Hellwig [Fri, 27 May 2022 08:19:14 +0000 (10:19 +0200)]
btrfs: test buffered I/O read repair with interleaved corrupted sectors

Test that repair handles the case where it needs to read from more than
a single mirror on the raid1c3 profile and needs to take turns over the
mirrors to recover data for the whole read.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs: test repair with sectors corrupted in multiple mirrors
Christoph Hellwig [Fri, 27 May 2022 08:19:13 +0000 (10:19 +0200)]
btrfs: test repair with sectors corrupted in multiple mirrors

Test that repair handles the case where it needs to read from more than
a single mirror on the raid1c3 profile.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs/215: use _btrfs_get_first_logical
Christoph Hellwig [Fri, 27 May 2022 08:19:12 +0000 (10:19 +0200)]
btrfs/215: use _btrfs_get_first_logical

Use the _btrfs_get_first_logical helper instead of open coding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs/157: use _btrfs_get_first_logical
Christoph Hellwig [Fri, 27 May 2022 08:19:11 +0000 (10:19 +0200)]
btrfs/157: use _btrfs_get_first_logical

Use the _btrfs_get_first_logical helper instead of open coding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs/143: use common read repair helpers
Christoph Hellwig [Fri, 27 May 2022 08:19:10 +0000 (10:19 +0200)]
btrfs/143: use common read repair helpers

Use the common helpers to find the btrfs logical address and to read from
a specific mirror.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs/142: use common read repair helpers
Christoph Hellwig [Fri, 27 May 2022 08:19:09 +0000 (10:19 +0200)]
btrfs/142: use common read repair helpers

Use the common helpers to find the btrfs logical address and to read from
a specific mirror.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs/141: use common read repair helpers
Christoph Hellwig [Fri, 27 May 2022 08:19:08 +0000 (10:19 +0200)]
btrfs/141: use common read repair helpers

Use the common helpers to find the btrfs logical address and to read from
a specific mirror.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs/140: use common read repair helpers
Christoph Hellwig [Fri, 27 May 2022 08:19:07 +0000 (10:19 +0200)]
btrfs/140: use common read repair helpers

Use the common helpers to find the btrfs logical address and to read from
a specific mirror.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs: add a helpers for read repair testing
Christoph Hellwig [Fri, 27 May 2022 08:19:06 +0000 (10:19 +0200)]
btrfs: add a helpers for read repair testing

Add a few helpers to consolidate code for btrfs read repair testing:

 - _btrfs_get_first_logical() gets the btrfs logical address for the
   first extent in a file
 - _btrfs_get_device_path and _btrfs_get_physical use the
   btrfs-map-logical tool to find the device path and physical address
   for btrfs logical address for a specific mirror
 - _btrfs_direct_read_on_mirror and _btrfs_buffered_read_on_mirror
   read the data from a specific mirror

These will be used to consolidate the read repair tests and avoid
duplication for new tests.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/545: check for fallocate support before running test
Darrick J. Wong [Tue, 24 May 2022 19:52:19 +0000 (12:52 -0700)]
xfs/545: check for fallocate support before running test

This test fails when alwayscow mode is enabled:

 QA output created by 545
+fallocate: Operation not supported
 Creating directory system to dump using fsstress.

Fix this by checking for fallocate support first.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agotests: remove redundant common/$FSTYP importing
Zorro Lang [Thu, 26 May 2022 01:23:17 +0000 (09:23 +0800)]
tests: remove redundant common/$FSTYP importing

As fstests intensively source specific common/$FSTYP files in
common/rc, at the beginning of ./check running. Each single case
doesn't need to import that again.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
2 years agocommon: source base fs specific common file
Zorro Lang [Wed, 25 May 2022 07:34:26 +0000 (15:34 +0800)]
common: source base fs specific common file

When tests overlayfs, sometimes we need the underlying fs specific
helpers, e.g. common/rc has:
  _filesystem_timestamp_range $OVL_BASE_TEST_DEV $OVL_BASE_FSTYP

So when we source common/overlay, better to source OVL_BASE_FSTYP
too.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
2 years agoceph/001: skip metrics check if no copyfrom mount option is used
Luís Henriques [Tue, 24 May 2022 09:42:56 +0000 (10:42 +0100)]
ceph/001: skip metrics check if no copyfrom mount option is used

Checking the metrics is only valid if 'copyfrom' mount option is
explicitly set, otherwise the kernel won't be doing any remote object
copies.  Fix the logic to skip this metrics checking if 'copyfrom' isn't
used.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: Zorro Lang <zlang@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs: annotate fix commits for upcoming 5.10.y backports
Amir Goldstein [Fri, 20 May 2022 14:32:49 +0000 (17:32 +0300)]
xfs: annotate fix commits for upcoming 5.10.y backports

In preparation for backporting xfs fixes to stable kernel 5.10.y,
annotate some of the tests that pass after applying the backports.

Most of the annotated tests have the fix commit documented either
in comment or in commit message already.

All tests have been verified to pass with fix commits apply, but
for a few tests, a failure was observed when running on kernel without
the documented fix commit. That is probably because failure happens
only on a specific setup.

Generic tests have also been annotated with xfs fix commits.
That may produce wrong hints if the test fails on another fs, but
that is what hints are for - to give tester a hint, so if tester is
not testing xfs, it's easy to figure out that the hint is irrelevant.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoceph/002: fix test expected output
Luís Henriques [Fri, 20 May 2022 09:47:09 +0000 (10:47 +0100)]
ceph/002: fix test expected output

Commit daa0c0146c7d ("fstests: replace hexdump with od command") broke
ceph/002 by adding an extra '0' in the offset column.  Fix it.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agotools/mkgroupfile: help the cases of group.list in number order v2022.05.22
Zorro Lang [Sat, 21 May 2022 05:32:19 +0000 (13:32 +0800)]
tools/mkgroupfile: help the cases of group.list in number order

The mkgroupfile doesn't sort cases in number order, that cause
fstests' ./new script can't find a proper number which isn't taken.
The unsorted case number might cause more problems, so fix it.

Fixes: 441606d28681 ("fstests: faster group file creation")
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agofstests: fix group list generation for whacky test names
Dave Chinner [Tue, 17 May 2022 07:01:03 +0000 (17:01 +1000)]
fstests: fix group list generation for whacky test names

Darrick noticed that tests/xfs/191-input-validation didn't get
generated properly. Fix the regex to handle this.

$ grep -I -R "^_begin_fstest" tests/xfs | \
  sed -e 's/^.*\/\([0-9]*\):_begin_fstest/\1/' |grep 191
tests/xfs/191-input-validation:_begin_fstest auto quick mkfs realtime
$
$ grep -I -R "^_begin_fstest" tests/xfs | \
  sed -e 's/^.*\/\([0-9]*\).*:_begin_fstest/\1/ ' |grep 191
191 auto quick mkfs realtime
$

Use the regexes for matching test names defined in common/test_names
rather than trying to open code it.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2 years agofstests: remove xfs deprecated test
Dave Chinner [Tue, 17 May 2022 12:15:48 +0000 (20:15 +0800)]
fstests: remove xfs deprecated test

Remove xfs/018, xfs/081 and xfs/082 entirely, as they're deprecated
and obsolete for long time.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/191: remove broken test
Dave Chinner [Tue, 17 May 2022 07:01:11 +0000 (17:01 +1000)]
xfs/191: remove broken test

Test has been marked broken for a long time. Original intent of
validating all mkfs.xfs input is not realistic, nobody is going to
try to make that happen.

Remove it as it serves no useful purpose except to have a whacky
unique name that nobody expects or codes for.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/148: fix failure from bad shortform size assumptions
Dave Chinner [Tue, 17 May 2022 07:01:06 +0000 (17:01 +1000)]
xfs/148: fix failure from bad shortform size assumptions

We replaced an attr named:

slashstr="are_bad_for_you"

with this substitution:

cp $imgfile $imgfile.old
sed -b \
        -e "s/$nullstr/too_many\x00beans/g" \
        -e "s/$slashstr/are_bad\/for_you/g" \
        -i $imgfile

We then try to retreive the attr named 'a_are_bad/for_you'. The
failure is:

    -Attribute "a_are_bad/for_you" had a 3 byte value for TEST_DIR/mount-148/testfile:
    -heh
    +attr_get: No data available
    +Could not get "a_are_bad/for_you" for TEST_DIR/mount-148/testfile

The error returned is ENODATA - the xattr does not exist. While the
name might exist in the attr leaf block:

....
nvlist[0].valuelen = 3
nvlist[0].namelen = 17
nvlist[0].name = "a_are_bad/for_you"
nvlist[0].value = "heh"
nvlist[1].valuelen = 3
....

xattrs are not looked up by name matches when in leaf or node form
like they are in short form.  They are looked up by *name hash*
matches, and if the hash is not found, then the name does not exist.
Only if the has match is found, then it goes and retrieves the xattr
pointed to by the hash and checks the name.

At this point, it should be obvious that the hash of
"a_are_bad_for_you" is different to "a_a_are_bad/for_you". Hence the
leaf lookup is always rejected at the hash match stage and never
gets to the name compare stage.

IOWs, this test can *never* pass when the xattr is in leaf/node
form, only when it is in short form.

The reason the attr fork is in leaf form is that we are using
"-m crc=0" and so the inodes are only 256 bytes in size and can only
hold ~150 bytes in the literal area. That leaves ~100 bytes maximum
for shortform attr data. The test consumes ~80 bytes of shortform
space, so it should fit and the test pass.

However:

nvlist[4].valuelen = 37
nvlist[4].namelen = 7
nvlist[4].name = "selinux"
nvlist[4].value = "unconfined_u:object_r:unlabeled_t:s0\000"

Yes, I run the fstests with selinux enabled on some of test
machines. The selinux attr pushes the attr fork way over the size
that can fit in the shortform literal area, and so it moves to leaf
form as the attrs are initially added and the test fails.

Fix this by forcing the test to use 512 byte inodes, so as to
provide around 350 bytes of usable attr fork literal area so it's
not affected by security attributes.

While there, clean up the silly conditional loop device cleanup
code.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/148: make test debuggable
Dave Chinner [Tue, 17 May 2022 07:01:05 +0000 (17:01 +1000)]
xfs/148: make test debuggable

Don't clean up image files - leave them laying around on the test
device so that when the test fails there's a corpse left behind to
post-mortem....

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/348: golden output is not correct
Dave Chinner [Tue, 17 May 2022 07:01:02 +0000 (17:01 +1000)]
xfs/348: golden output is not correct

The output of xfs/348 encodes the observed behaviour at the time the
test was written, not the correct behaviour that should occur.
Recent improvements in verification checking in the upstream kernel
(1eb70f54c445 "xfs: validate inode fork size against fork format")
have resulted in the kernel having correct behaviour and now the
test fails. Fix the test output to reflect correct behaviour.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/122: add attribute log formats to test output.
Dave Chinner [Tue, 17 May 2022 07:01:01 +0000 (17:01 +1000)]
xfs/122: add attribute log formats to test output.

Now that we have merged logged attributes, add the attribute log
format sizes to the on-disk structure size checking.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agofstests: filter quota warnings
Dave Chinner [Tue, 17 May 2022 07:01:00 +0000 (17:01 +1000)]
fstests: filter quota warnings

Quota warning code has been removed from the upstream kernel and now
returns -EINVAL errors. Seeing as we can't set warnings anymore and
they have always been non-functional in the kernel, just remove the
calls to set warnings filter those errors out so those tests pass
again.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agocommon/rc: fix test init performance regression on XFS
Dave Chinner [Fri, 20 May 2022 01:23:36 +0000 (11:23 +1000)]
common/rc: fix test init performance regression on XFS

I've been having problems over the past month with tests randomly
running much slower than they should. The overall effect has been
that running an auto group iterate has blown out from about 3
hours to almost 5 hours.

The problem has been that the root disks have been thrashing.
Thousands of iops and the backing store getting IO bound so all test
vms with root drive images hosted on that backing store then also
go slow.

I finally got to the bottom of it - it looked for all the world like
a qemu image format write amplification problem, because I couldn't
capture anything unusual from inside the guest. I converted all
the root images to raw format on fast SSD storage, and the problem
didn't go away - while some tests were faster, other tests were
still randomly slow.

Finally I tracked it down with blktrace/blkparse. All the IO was
coming from processes with the command line like:

 /sbin/mkfs.xfs -d file name=/tmp/791409.img size=512m

A quick grep then pointed me at common/rc::init_rc() where there is
a test for XFS specific on-disk format behaviour that uses that
exact command line.

init_rc() is run from _begin_fstest() so it is executed on every
test start. We run mkfs to create a 512MB filesystem in $tmp on
every test start. That's ..... not smart. And we do it so we can
change the setup of $XFS_COPY_PROG, which is only used in a handful
of tests. That's also .... not smart.

And then the penny dropped: we recently increased the default log
size of small filesystems, so this is now zeroing a 64MB log instead
of a 5-10MB log. And, of course it's on the root drive because of
the $tmp image prefix, which in this case is ext3, and it's
fragmenting the crap out of the writes and so it increases runtime
of the mkfs.xfs execution from nothing to 5-10s.

Then when one of these mkfs invocations co-incides with journal
flushing driven writeback, everything just stops until the writeback
stops thrashing. And so all tests are 5-10s slows, and random tests
take anywhere between 20-100s longer to start up....

Fix it by moving the setup of XFS_COPY_PROG to _require_xfs_copy()
so only the tests that use xfs_copy run this code.

Numbers don't lie:

generic/001 11s ...  6s
generic/002 9s ...  1s
generic/003 17s ...  10s
generic/004 12s ...  1s
generic/005 9s ...  1s
generic/006 9s ...  2s
generic/007 11s ...  3s
generic/008 5s ...  2s
generic/009 10s ...  2s
generic/010 5s ...  0s
generic/011 9s ...  1s
generic/012 7s ...  2s
generic/013 10s ...  5s
generic/014 11s ...  1s
generic/015 7s ...  1s
generic/016 7s ...  2s
.....

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agofstests: tests should not source common/rc directly
Dave Chinner [Fri, 20 May 2022 01:23:35 +0000 (11:23 +1000)]
fstests: tests should not source common/rc directly

_begin_fstest() does this as every test needs it, so remove it from
all the tests that source it a second time.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Acked-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agogeneric/556: add test case for top-level dir rename
Eric Biggers [Sat, 14 May 2022 18:01:46 +0000 (11:01 -0700)]
generic/556: add test case for top-level dir rename

Test renaming a casefolded directory located in the top-level directory,
while the cache is cold.  When $MOUNT_OPTIONS contains
test_dummy_encryption, this detects an f2fs bug.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agogeneric/556: Filter touch error message
Gabriel Krisman Bertazi [Fri, 20 May 2022 17:18:52 +0000 (13:18 -0400)]
generic/556: Filter touch error message

Coreutils commit d435cfc0bc55 ("touch: fix wrong
diagnostic (Bug#48106)"), released in coreutils v9.0, changed the error
reported by the tool when openat() fails with EINVAL.  Instead of
reporting a generic message for the failure of either openat() or the
following utimensat(), it now differentiates both failures with
different messages.

This change breaks generic/556, which relied on the parsing of that
message.  This test was originally developed by me on a Debian
Buster (coreutils v8.x), so I used the generic error message.  Now that
I tried to run it on a more modern distro, it reports a different error
message, which fails the test, as shown below:

  output mismatch (see /tmp/results/generic/556.out.bad)
      --- tests/generic/556.out 2022-05-20 13:15:00.447525770 -0400
      +++ /tmp/results/generic/556.out.bad 2022-05-20 13:15:24.988167427 -0400
      @@ -12,5 +12,5 @@
       # file: SCRATCH_MNT/xattrs/x/f1
       user.foo="bar"

      -touch: setting times of 'SCRATCH_MNT/strict/corac'$'\314\247\303': Invalid argument
      -touch: setting times of 'SCRATCH_MNT/strict/cora'$'\303\247\303': Invalid argument
      +touch: cannot touch 'SCRATCH_MNT/strict/corac'$'\314\247\303': Invalid argument
      +touch: cannot touch 'SCRATCH_MNT/strict/cora'$'\303\247\303': Invalid argument
      ...

The fix filters out the touch-specific parts of the touch error
messages, to prevent breakage from future changes, but preserves the
return code information, which is actually useful (and more stable).

There is no change in behavior on the kernel side, just a broken test.
On both older and new distros, the kernel correctly rejects this invalid
sequence with -EINVAL, as shown in the strace hunk below:

  [...]
  openat(AT_FDCWD, "/scratch_mnt/strict/corac\314\247\303", ...) = -1 EINVAL
  utimensat(AT_FDCWD, "/scratch_mnt/strict/corac\314\247\303", ...) = -1 EINVAL
  [...]

Tested on Debian sid (coreutils v8.32) and Fedora (coreutils 9.0).

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agofstests: add a btrfs read_repair group
Christoph Hellwig [Tue, 17 May 2022 06:35:02 +0000 (08:35 +0200)]
fstests: add a btrfs read_repair group

Add a new group to run all tests the exercise the btrfs read_repair code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agogeneric/603: use project quota create and restore common helpers
Zorro Lang [Thu, 12 May 2022 15:16:56 +0000 (23:16 +0800)]
generic/603: use project quota create and restore common helpers

As common/quota has _create_project_quota and _restore_project_quota
helpers now, so replace local similar functions with them.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agogeneric: soft quota limits testing within grace time
Zorro Lang [Mon, 9 May 2022 17:17:22 +0000 (01:17 +0800)]
generic: soft quota limits testing within grace time

After soft limits are exceeded, within the grace time, fs quota
should allow more space allocation before exceeding hard limits,
even if allocating many small files.

This case can cover bc37e4fb5cac (xfs: revert "xfs: actually bump
warning counts when we send warnings"). And will help to expose
later behavior changes on this side.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@redhat.com>
2 years agocommon/rc: Modify _require_batched_discard to improve test coverage
Ojaswin Mujoo [Mon, 16 May 2022 08:45:05 +0000 (14:15 +0530)]
common/rc: Modify _require_batched_discard to improve test coverage

A recent ext4 patch discussed [1] that some devices (eg LVMs) can
have a discard granularity as big as 42MB which makes it larger
than the group size of ext4 FS with 1k BS.  This causes the FITRIM
IOCTL to fail.

This case was not correctly handled by this test since
"_require_batched_discard" incorrectly interpreted the FITRIM
failure as SCRATCH_DEV not supporting the IOCTL. This caused the test
to report "not run" instead of "failed" in case of large discard granularity.

Fix "_require_batched_discard" to use a more accurate method
to determine if discard is supported.

[1] commit 173b6e383d2
    ext4: avoid trim error on fs with small groups

Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agovfs/idmapped-mounts: remove invalid test v2022.05.15
Christian Brauner [Thu, 12 May 2022 16:52:50 +0000 (18:52 +0200)]
vfs/idmapped-mounts: remove invalid test

The threaded mount interaction test validates that the idmapping of a
mount behaves correctly when changed while another process already has a
writable file descriptor to that mount. In newer kernels it isn't
possible to change a mount's idmapped if someone has a writable file
descriptor to that mount.

Link: e1bbcd277a53 ("fs: hold writers when changing mount's idmapping")
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agovfstest: split out remaining idmapped mount tests
Christian Brauner [Thu, 12 May 2022 16:52:49 +0000 (18:52 +0200)]
vfstest: split out remaining idmapped mount tests

Split out all the remaining idmapped mount tests into the idmapped
mounts source file.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agovfstest: split out btrfs idmapped mounts test
Christian Brauner [Thu, 12 May 2022 16:52:48 +0000 (18:52 +0200)]
vfstest: split out btrfs idmapped mounts test

Split the btrfs specific idmapped mounts test into a separate source
file.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agovfstest: split idmapped mount tests into separate suite
Christian Brauner [Thu, 12 May 2022 16:52:47 +0000 (18:52 +0200)]
vfstest: split idmapped mount tests into separate suite

Now that we finished restructuring split the core idmapped mounts test
suite into a separate source file.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoutils: add struct test_suite
Christian Brauner [Thu, 12 May 2022 16:52:46 +0000 (18:52 +0200)]
utils: add struct test_suite

Provide a convenient wrapper struct which provides the tests and the
number of tests. The struct can be kept local to each source file so we
are sure that the tests and number of tests is correct.

In vfstest.c we provide a run_suite() function which expects a struct
test_suite and runs the tests provided by that suite.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agomissing: move sys_execveat() to missing.h
Christian Brauner [Thu, 12 May 2022 16:52:45 +0000 (18:52 +0200)]
missing: move sys_execveat() to missing.h

The missing.h header provides syscalls potentially missing from the used
libc. Move the sys_execveat() definition into it. It doesn't belong into
vfstest.c.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoutils: move helpers into utils
Christian Brauner [Thu, 12 May 2022 16:52:44 +0000 (18:52 +0200)]
utils: move helpers into utils

In order to split the test suite into multiple source files we need to
be able to access generic helpers in all source files not just one. So
move all generic helpers into utils.{c,h}.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoutils: add struct vfstest_info
Christian Brauner [Thu, 12 May 2022 16:52:43 +0000 (18:52 +0200)]
utils: add struct vfstest_info

So far we were able to rely on global variables as the idmapped mount
test suite was a single source file. But that gets messy when we split
it into multiple source files in the following patches. Instead of
global variables introduce struct vfstest_info which provides all
information about the test suite run and pass it to all tests.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoutils: add missing global.h include
Christian Brauner [Thu, 12 May 2022 16:52:42 +0000 (18:52 +0200)]
utils: add missing global.h include

Make sure that utils.{c,h} have access to the necessary defines created
during the configure stage when building xfstests.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agovfstest: rename struct t_idmapped_mounts
Christian Brauner [Thu, 12 May 2022 16:52:41 +0000 (18:52 +0200)]
vfstest: rename struct t_idmapped_mounts

The idmapped mounts test suite has grown to cover a lot of generic vfs
functionality that is not concerned with idmapped mounts at all.

As was discussed upstream it's time to rename it to something that
reflects its generic nature.

Rename the basic structure used for the tests from struct
t_idmapped_mounts to struct test_struct.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agosrc/vfs: rename idmapped-mounts.c file
Christian Brauner [Thu, 12 May 2022 16:52:40 +0000 (18:52 +0200)]
src/vfs: rename idmapped-mounts.c file

The idmapped mounts test suite has grown to cover a lot of generic vfs
functionality that is not concerned with idmapped mounts at all.

As was discussed upstream it's time to rename it to something that
reflects its generic nature. So rename the source file from
idmapped-mounts.c to vfstest.c before we split it into multiple source
files in the next patches.

[Zorro: fix generic/689]

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agosrc: rename idmapped-mounts folder
Christian Brauner [Thu, 12 May 2022 16:52:39 +0000 (18:52 +0200)]
src: rename idmapped-mounts folder

The idmapped mounts test suite has grown to cover a lot of generic vfs
functionality that is not concerned with idmapped mounts at all.

As was discussed upstream it's time to rename it to something that
reflects its generic nature. So rename it from idmapped-mounts to vfs.

[Zorro: fix generic/689 and add it into idmapped test group]

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoidmapped-mounts: make all tests set their required feature flags
Christian Brauner [Thu, 12 May 2022 16:52:38 +0000 (18:52 +0200)]
idmapped-mounts: make all tests set their required feature flags

In commit 858a19c5e9b0 ("idmapped_mounts: Prepare for support for more
features") we introduced a flag argument to check for multiple features
and then decide based on the flag argument whether a test requires a
given feature and skip it if the kernel doesn't provide it.

However, not all tests were ported to the new flag argument and still
use the old infrastructure. Port them all.

Fixes: 858a19c5e9b0 ("idmapped_mounts: Prepare for support for more features")
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agocasefold: Fix expansion of seqres variable
Gabriel Krisman Bertazi [Wed, 11 May 2022 16:33:40 +0000 (12:33 -0400)]
casefold: Fix expansion of seqres variable

seqres is not properly expanded on these error paths, causing a file
called seqres.full to be created instead.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>