xfstests-dev.git
14 months agogeneric/204: sync before scrub hits EIO
Darrick J. Wong [Tue, 15 Sep 2020 01:45:21 +0000 (18:45 -0700)]
generic/204: sync before scrub hits EIO

Let's see if we can prevent fs corruption warnings by flushing dirty
data to disk before the test ends.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agoxfs/141: run for longer with TIME_FACTOR
Darrick J. Wong [Tue, 15 Sep 2020 01:45:15 +0000 (18:45 -0700)]
xfs/141: run for longer with TIME_FACTOR

Allow the test runner to run the crash loop in this test for longer by
setting TIME_FACTOR.  This has been useful for finding bugs in log
recovery.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agocommon/rc: teach _scratch_mkfs_sized to set a size on an xfs realtime volume
Darrick J. Wong [Fri, 18 Sep 2020 02:08:33 +0000 (19:08 -0700)]
common/rc: teach _scratch_mkfs_sized to set a size on an xfs realtime volume

Generally speaking, tests that call _scratch_mkfs_sized are trying to
constrain a test's run time by formatting a filesystem that's smaller
than the device.  The current helper does this for the scratch device,
but it doesn't do this for the xfs realtime volume.

If fstests has been configured to create files on the realtime device by
default ("-d rtinherit=1) then those tests that want to run with a small
volume size will instead be running with a huge realtime device.  This
makes certain tests take forever to run, so apply the same sizing to the
rt volume if one exists.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agoxfs/449: fix xfs info report output if realtime device specified
Darrick J. Wong [Tue, 15 Sep 2020 01:45:02 +0000 (18:45 -0700)]
xfs/449: fix xfs info report output if realtime device specified

Modify the mkfs.xfs output so that "realtime =/dev/XXX" becomes
"realtime =external" so that the output will match xfs_db, which doesn't
take a rt device argument and thus does not know.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agoxfs/424: disable external devices
Darrick J. Wong [Tue, 15 Sep 2020 01:44:56 +0000 (18:44 -0700)]
xfs/424: disable external devices

This test uses an open-coded call to mkfs, so we need to disable the
external devices so that _scratch_xfs_db doesn't get confused.  We also
disable the post-check fsck because it's run by the parent ./check
program, which won't know that we didn't use the external devices.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agoxfs/291: fix open-coded repair call to mdrestore'd fs image
Darrick J. Wong [Tue, 15 Sep 2020 01:44:50 +0000 (18:44 -0700)]
xfs/291: fix open-coded repair call to mdrestore'd fs image

Attach any external log devices to the open-coded repair call.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agoxfs: refactor _xfs_check calls to the scratch device
Darrick J. Wong [Tue, 15 Sep 2020 01:44:43 +0000 (18:44 -0700)]
xfs: refactor _xfs_check calls to the scratch device

Use _scratch_xfs_check, not _xfs_check $SCRATCH_DEV.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agoxfs/098: adapt to external log devices
Darrick J. Wong [Tue, 15 Sep 2020 01:44:37 +0000 (18:44 -0700)]
xfs/098: adapt to external log devices

Teach this test to deal with external log devices correctly.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agocommon/xfs: extract minimum log size message from mkfs correctly
Darrick J. Wong [Tue, 15 Sep 2020 01:44:24 +0000 (18:44 -0700)]
common/xfs: extract minimum log size message from mkfs correctly

Modify the command that searches for the minimum log size message from
mkfs to handle external log devices correctly.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agogeneric/204: don't flood stdout with ENOSPC messages on an ENOSPC test
Darrick J. Wong [Tue, 15 Sep 2020 01:44:18 +0000 (18:44 -0700)]
generic/204: don't flood stdout with ENOSPC messages on an ENOSPC test

This test has been on and off my bad list for many years due to the fact
that it will spew potentially millions of "No space left on device"
errors if the file count calculations are wrong.  The calculations
should be correct for the XFS data device, but they don't apply to other
filesystems.

Therefore, filter out the ENOSPC messages when the files are not going
to be created on the xfs data device (e.g. ext4, xfs realtime, etc.)

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agooverlay/020: make sure the system supports the required namespaces
Darrick J. Wong [Tue, 15 Sep 2020 01:44:12 +0000 (18:44 -0700)]
overlay/020: make sure the system supports the required namespaces

Don't run this test if the kernel doesn't support namespaces.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agooverlay/{069,071}: fix undefined variables
Darrick J. Wong [Tue, 15 Sep 2020 01:44:05 +0000 (18:44 -0700)]
overlay/{069,071}: fix undefined variables

Change OVL_BASE_TEST_MNT -> OVL_BASE_TEST_DIR, since the former is not
actually defined anywhere.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agoxfs: add a _require_xfs_copy helper
Darrick J. Wong [Tue, 15 Sep 2020 01:43:59 +0000 (18:43 -0700)]
xfs: add a _require_xfs_copy helper

Add a _require helper so that tests can ensure that they're running in
the correct environment for xfs_copy to work (no external devices).

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agoxfs/070: add scratch log device options to direct repair invocation
Darrick J. Wong [Tue, 15 Sep 2020 01:43:53 +0000 (18:43 -0700)]
xfs/070: add scratch log device options to direct repair invocation

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agoxfs: replace open-coded calls to xfs_logprint with helpers
Darrick J. Wong [Tue, 15 Sep 2020 01:43:47 +0000 (18:43 -0700)]
xfs: replace open-coded calls to xfs_logprint with helpers

Use the test/scratch xfs_logprint helpers.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agoxfs/{111,137}: replace open-coded calls to repair with _scratch_xfs_repair
Darrick J. Wong [Tue, 15 Sep 2020 01:43:40 +0000 (18:43 -0700)]
xfs/{111,137}: replace open-coded calls to repair with _scratch_xfs_repair

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agoxfs: wrap xfs_db calls to the test device
Darrick J. Wong [Tue, 15 Sep 2020 01:43:34 +0000 (18:43 -0700)]
xfs: wrap xfs_db calls to the test device

Create a _test_xfs_db analogue to _scratch_xfs_db so that we can
encapsulate whatever strange test fs options were fed to us by the test
runner.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agoxfs/{019, 031}: make sure we don't set rtinherit=1 on mkfs
Darrick J. Wong [Tue, 15 Sep 2020 01:43:27 +0000 (18:43 -0700)]
xfs/{019, 031}: make sure we don't set rtinherit=1 on mkfs

mkfs.xfs does not support setting rtinherit on the root directory /and/
pre-populating the filesystem with protofiles, so don't run this test if
rtinherit is in the mkfs options.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agoxfs: skip tests that rely on allocation behaviors of the data device
Darrick J. Wong [Tue, 15 Sep 2020 01:43:21 +0000 (18:43 -0700)]
xfs: skip tests that rely on allocation behaviors of the data device

A large number of xfs-specific tests rely on specific behaviors of the
data device allocator, such as fragmenting free space, carefully curated
inode and free space counts, or features like filestreams that only
exist on the data device.

These tests fail horribly if the test runner specified rtinherit=1 on
the mkfs command line, so skip them all.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agogeneric/607: don't break on filesystems that don't support FSGETXATTR on dirs
Darrick J. Wong [Tue, 15 Sep 2020 01:43:15 +0000 (18:43 -0700)]
generic/607: don't break on filesystems that don't support FSGETXATTR on dirs

This test requires that the filesystem support calling FSGETXATTR on
regular files and directories to make sure the FS_XFLAG_DAX flag works.
The _require_xfs_io_command tests a regular file but doesn't check
directories, so generic/607 should do that itself.  Also fix some typos.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agogeneric/60[01]: fix test failure when setting new grace limit
Darrick J. Wong [Tue, 15 Sep 2020 01:43:08 +0000 (18:43 -0700)]
generic/60[01]: fix test failure when setting new grace limit

The setquota command can extend a quota grace period by a certain number
of seconds.  The extension is provided as a number of seconds relative
to right now.  However, if the system clock increments the seconds count
after this test assigns $now but before setquota gets called, the test
will fail because $get and $set will be off by that 1 second.  Allow for
that.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agoxfs/331: don't run this test if fallocate isn't supported
Darrick J. Wong [Tue, 15 Sep 2020 01:43:00 +0000 (18:43 -0700)]
xfs/331: don't run this test if fallocate isn't supported

This test requires fallocate, so make sure that actually works before
running it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agoxfs: Add realtime group
Chandan Babu R [Fri, 18 Sep 2020 03:30:12 +0000 (09:00 +0530)]
xfs: Add realtime group

This commit adds a new group to classify tests that can work with
realtime devices.

Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agocommon/rc: Add extra check for xfs_io -c "chattr" on XFS
Xiao Yang [Mon, 14 Sep 2020 05:14:00 +0000 (13:14 +0800)]
common/rc: Add extra check for xfs_io -c "chattr" on XFS

On XFS, ioctl(FSSETXATTR)(called by xfs_io -c "chattr") maskes off unsupported
or invalid flags silently.  For example,
1) With kernel v4.4 which doesn't support dax flag, try to set dax flag on a
file by the lastest xfs_io -c "chattr" command:
--------------------------------------------
0
----------------X testfile
--------------------------------------------
2) Realtime inheritance flag is only valid for a directory and try to set
realtime inheritance flag on a file:
--------------------------------------------
0
----------------X testfile
--------------------------------------------

In this case, we need to check these flags by extra ioctl(FSGETXATTR)(called
by xfs_io -c "lsattr").

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agocommon/rc: Check 'tPnE' flags on a directory instead of a regilar file
Xiao Yang [Mon, 14 Sep 2020 05:13:59 +0000 (13:13 +0800)]
common/rc: Check 'tPnE' flags on a directory instead of a regilar file

'tPnE' flags are only valid for a directory so check them on a directory.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agogeneric: add test for boundary in xfs_attr_shortform_verify
Pavel Reichl [Tue, 15 Sep 2020 13:26:51 +0000 (15:26 +0200)]
generic: add test for boundary in xfs_attr_shortform_verify

Add a regression test to check that the boundary test
for the fixed-offset parts of xfs_attr_sf_entry
in xfs_attr_shortform_verify is not off by one.

This can be shown by:

touch file
setfattr -n user.a file

Signed-off-by: Pavel Reichl <preichl@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agogeneric/470: use thin volume for dmlogwrites target device
Brian Foster [Tue, 1 Sep 2020 13:47:28 +0000 (09:47 -0400)]
generic/470: use thin volume for dmlogwrites target device

dmlogwrites support for XFS depends on discard zeroing support of
the intended target device. Update the test to use a thin volume and
allow it to run consistently and reliably on XFS.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agogeneric/457: use thin volume for dmlogwrites target device
Brian Foster [Tue, 1 Sep 2020 13:47:27 +0000 (09:47 -0400)]
generic/457: use thin volume for dmlogwrites target device

dmlogwrites support for XFS depends on discard zeroing support of
the intended target device. Update the test to use a thin volume and
allow it to run consistently and reliably on XFS.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agogeneric/455: use thin volume for dmlogwrites target device
Brian Foster [Tue, 1 Sep 2020 13:47:26 +0000 (09:47 -0400)]
generic/455: use thin volume for dmlogwrites target device

dmlogwrites support for XFS depends on discard zeroing support of
the intended target device. Update the test to use a thin volume and
allow it to run consistently and reliably on XFS.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agofstests: explicitly specify xattr namespace
Frank van der Linden [Thu, 10 Sep 2020 19:43:55 +0000 (19:43 +0000)]
fstests: explicitly specify xattr namespace

Explicitly specify the xattr namespace required for tests.
This allows tests to be skipped correctly for filesystems
that don't support all xattr namespaces.

This changes all tests that require anything other than
the "user" xattr namespace. When called without arguments
as before, _require_attrs() still defaults to the "user"
namespace, so those tests do not need to be changed.

Signed-off-by: Frank van der Linden <fllinden@amazon.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agocommon/attr: set MAX_ATTR values correctly for NFS
Frank van der Linden [Thu, 10 Sep 2020 19:43:54 +0000 (19:43 +0000)]
common/attr: set MAX_ATTR values correctly for NFS

Now that NFS can handle user xattrs, set the MAX_ATTR
and MAX_ATTRVAL_SIZE to reflect the applicable limits
for that filesystem.

Signed-off-by: Frank van der Linden <fllinden@amazon.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agocommon/attr: make _require_attrs more fine-grained
Frank van der Linden [Thu, 10 Sep 2020 19:43:53 +0000 (19:43 +0000)]
common/attr: make _require_attrs more fine-grained

Filesystems may not support all xattr types. But, _require_attr assumes
that being able to use "user" namespace xattrs means that all namespaces
("trusted", "system", etc) are supported. This breaks on NFS, that only
supports the "user" namespace, and a few cases in the "system" namespace.

Change _require_attrs to optionally take namespace arguments that specify
the namespaces to check for. The default behavior (no arguments) is still
to check for the "user" namespace only.

Signed-off-by: Frank van der Linden <fllinden@amazon.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agogeneric: add test for zero range over a file range with many small extents
Filipe Manana [Tue, 8 Sep 2020 10:32:02 +0000 (11:32 +0100)]
generic: add test for zero range over a file range with many small extents

Test a fallocate() zero range operation against a large file range for which
there are many small extents allocated. Verify the operation does not fail
and the respective range return zeroes on subsequent reads.

This test is motivated by a bug found on btrfs. The patch that fixes the
bug on btrfs has the following subject:

 "btrfs: fix metadata reservation for fallocate that leads to transaction aborts"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agobtrfs: check if mount opts are applied
Marcos Paulo de Souza [Mon, 7 Sep 2020 18:39:12 +0000 (15:39 -0300)]
btrfs: check if mount opts are applied

This new test will apply different mount points and check if they
were applied by reading /proc/self/mounts. Almost all available
btrfs options are tested here, leaving only device=, which is tested
in btrfs/125 and space_cache, tested in btrfs/131.

This test does not apply any workload after the fs is mounted, just
checks is the option was set/unset correctly.

Kernel with the following patch should pass the test:
  btrfs: reset compression level for lzo on remount

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agobtrfs/154: remove test for fix that never landed
Johannes Thumshirn [Fri, 4 Sep 2020 11:45:30 +0000 (20:45 +0900)]
btrfs/154: remove test for fix that never landed

The btrfs/154 testcase fails if the kernel patch "btrfs: handle
dynamically reappearing missing device" isn't applied, but this patch was
never merged into the upstream kernel.

Delete the test so we have one less testcase that will always fail.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agogeneric: test deadlock on O_DIRECT|O_DSYNC
Josef Bacik [Wed, 2 Sep 2020 17:10:36 +0000 (13:10 -0400)]
generic: test deadlock on O_DIRECT|O_DSYNC

We had a problem recently where btrfs would deadlock with
O_DIRECT|O_DSYNC because of an unexpected dependency on ->fsync in
iomap.  This was only caught by chance with aiostress, because weirdly
we don't actually test this particular configuration anywhere in
xfstests.  Fix this by adding a basic test that just does
O_DIRECT|O_DSYNC writes.  With this test the box deadlocks right away
with Btrfs, which would have been helpful in finding this issue before
the patches were merged.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agobtrfs: add a test for some disk caching usecases
Josef Bacik [Wed, 2 Sep 2020 17:03:45 +0000 (13:03 -0400)]
btrfs: add a test for some disk caching usecases

This is a test to check the behavior of the disk caching code inside
btrfs.  It's a regression test for the patch

  btrfs: allow single disk devices to mount with older generations

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
14 months agobtrfs/011: skip if on too small devices
Johannes Thumshirn [Thu, 3 Sep 2020 12:18:15 +0000 (21:18 +0900)]
btrfs/011: skip if on too small devices

btrfs/011 does require a spare device of at least 10GB, skip if we don't
have big enough devices, e.g. when testing on ramdisks.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agobtrfs/174: Adjust error message when setting compressed flag
Nikolay Borisov [Mon, 17 Aug 2020 10:37:18 +0000 (13:37 +0300)]
btrfs/174: Adjust error message when setting compressed flag

Following kernel commit "btrfs: add missing check for nocow and
compression inode flags" btrfs refuses setting +c on +C files during
validation of the args. Account for this by adjusting the expected
error message.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agobtrfs/173: Adjust compress file check
Nikolay Borisov [Mon, 17 Aug 2020 10:37:17 +0000 (13:37 +0300)]
btrfs/173: Adjust compress file check

Following kernel commit "btrfs: add missing check for nocow and
compression inode flags" the enforcement of "can't set +c on a +C" file
has been moved to the ioctl code. Modify the test to account for this.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agoxfs/010,030: filter AG header CRC error warnings
Darrick J. Wong [Wed, 29 Jul 2020 02:51:19 +0000 (19:51 -0700)]
xfs/010,030: filter AG header CRC error warnings

Filter out the new AG header CRC verification warnings in xfs_repair
since these tests were built before that existed.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agogeneric/574: fix sporadic failure with test_dummy_encryption
Eric Biggers [Tue, 18 Aug 2020 06:30:23 +0000 (23:30 -0700)]
generic/574: fix sporadic failure with test_dummy_encryption

When the "test_dummy_encryption" mount option is specified, the
fs-verity file corruption test generic/574 is flaky; it fails about 1%
of the time.  This happens because in the three test cases where a
single byte of the test file is corrupted, sometimes the new byte
happens to be the same as the original.  This is specific to
test_dummy_encryption because the encrypted data is nondeterministic
(and appears random), unlike the unencrypted data.

Fix this by corrupting 5 bytes instead of 1, so that the probability of
failure becomes effectively zero.

Signed-off-by: Eric Biggers <ebiggers@google.com>
15 months agocommon/config: Allow sections names to contain hyphen
Nikolay Borisov [Thu, 25 Jun 2020 12:37:44 +0000 (15:37 +0300)]
common/config: Allow sections names to contain hyphen

Current regular expression in get_config_sections allows section names
to consist of alphanumeric character and underscore. Extend it to
also allow the hyphen '-' character.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agobtrfs: add a test for btrfs seed device stats
Josef Bacik [Thu, 20 Aug 2020 18:30:04 +0000 (14:30 -0400)]
btrfs: add a test for btrfs seed device stats

This is a regression test for the issue fixed by

  btrfs: init device stats for seed devices

We create a seed device, add a sprout device, and then check the device
stats after a remount to make sure it succeeds.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agobtrfs/205: Ignore output of chattr command
Nikolay Borisov [Thu, 20 Aug 2020 09:30:06 +0000 (12:30 +0300)]
btrfs/205: Ignore output of chattr command

With newer kernels, containing upstream commit f37c563bab42 ("btrfs:
add missing check for nocow and compression inode flags") chattr would
produce an error :

  /usr/bin/chattr: Invalid argument while setting flags on /media/scratch/foo1

That's due to the aforementioned commit making the checks stricter. This
is not critical for the purpose of the test so it can be safely
ignored.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agobtrfs/024: Remove no longer valid test
Nikolay Borisov [Mon, 17 Aug 2020 13:40:26 +0000 (16:40 +0300)]
btrfs/024: Remove no longer valid test

Kernel commit "btrfs: add missing check for nocow and compression inode
flags" invalidates the "file compressed, fs mounted with nodatacow"
mode due to doing more rigorous flags validation, just remove the test.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agocommon/rc: Update _exclude_scratch_mount_option() and _require_dm_target() for new...
Xiao Yang [Mon, 10 Aug 2020 16:29:09 +0000 (00:29 +0800)]
common/rc: Update _exclude_scratch_mount_option() and _require_dm_target() for new dax option

Some tests(e.g. ext4/035) cannot include dax option(dax=inode/dax=never
is OK) so make _exclude_scratch_mount_option() and _require_dm_target()
check if old dax or new dax=always option is not defined in $MOUNT_OPTIONS.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agocommon/dmlogwrites: Update _require_log_writes_dax() for new dax option
Xiao Yang [Mon, 10 Aug 2020 16:29:08 +0000 (00:29 +0800)]
common/dmlogwrites: Update _require_log_writes_dax() for new dax option

1) Rename _require_log_writes_dax to _require_log_writes_dax_mountopt.
2) Make _require_log_writes_dax_mountopt check if old or new dax option
   is supported.
3) generic/470 takes use of _require_log_writes_dax_mountopt.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agogeneric: Verify how to change the S_DAX flag on an existing file
Xiao Yang [Thu, 6 Aug 2020 02:13:42 +0000 (10:13 +0800)]
generic: Verify how to change the S_DAX flag on an existing file

Change FS_XFLAG_DAX on an existing file and check if S_DAX on the
file can take effect immediately by the following steps:
1) Stop all applications which are using the file.
2) Do drop_caches or umount & mount cycle.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agogeneric: Verify the inheritance behavior of FS_XFLAG_DAX flag in various combinations
Xiao Yang [Thu, 6 Aug 2020 02:13:41 +0000 (10:13 +0800)]
generic: Verify the inheritance behavior of FS_XFLAG_DAX flag in various combinations

Also factor out _check_xflag() so that other tests can use it in future.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agogeneric: Verify if statx() can qurey S_DAX flag on regular file correctly
Xiao Yang [Thu, 6 Aug 2020 02:13:40 +0000 (10:13 +0800)]
generic: Verify if statx() can qurey S_DAX flag on regular file correctly

1) With new kernel(e.g. v5.8-rc1), statx() can be used to qurey S_DAX flag
   on regular file, so add a test to verify the feature.
2) Factor out _check_s_dax() so that other tests can use it in future.

Reference:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=712b2698e4c024b561694cbcc1abba13eb0fd9ce

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agoxfs/260: Move and update xfs/260
Xiao Yang [Thu, 6 Aug 2020 02:13:39 +0000 (10:13 +0800)]
xfs/260: Move and update xfs/260

1) Both ext4 and xfs have supported FS_XFLAG_DAX so move it to generic.
2) Modifying FS_XFLAG_DAX on flies does not take effect immediately so
   make files inherit the DAX state of parent directory.
3) Setting/clearing FS_XFLAG_DAX have no chance to change S_DAX flag if
   mount with dax option so remove the related subtest.
4) Setting/clearing FS_XFLAG_DAX doesn't change S_DAX flag on older xfs
   due to commit 742d84290739 ("xfs: disable per-inode DAX flag") so
   only do test when fs supports new dax=inode option.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agogeneric/413, xfs/260: Improve format operation for PMD fault testing
Xiao Yang [Thu, 6 Aug 2020 02:13:38 +0000 (10:13 +0800)]
generic/413, xfs/260: Improve format operation for PMD fault testing

1) Simple code and fix the wrong value of stripe_width by _scratch_mkfs_geom().
2) Get hugepage size by _get_hugepagesize() and replace fixed 2M with
   hugepage size because hugepage size/PMD_SIZE is not 2M on some
   arches(e.g. hugepage size/PMD_SIZE is 512M on arm64).
3) For debugging, redirect the output of mkfs to $seqres.full.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agogeneric/223: Don't clear MKFS_OPTION before calling _scratch_mkfs_geom()
Xiao Yang [Thu, 6 Aug 2020 02:13:37 +0000 (10:13 +0800)]
generic/223: Don't clear MKFS_OPTION before calling _scratch_mkfs_geom()

Current _scratch_mkfs_geom() adds geometry parameters to the end of the
MKFS_OPTIONS blindly.  ext4 can accept the last one if geometry parameters
and original MKFS_OPTION have the same mkfs options but xfs cannot accept
them and reports "xxx option is respecified" error.  Make _scratch_mkfs_geom()
override the same mkfs options in original MKFS_OPTION by geometry parameters.

With this change, generic/223 doesn't need to clear original MKFS_OPTION
before calling _scratch_mkfs_geom() and can use other mkfs options in original
MKFS_OPTION.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agofstests: Use _require_scratch_dax_mountopt() and _require_dax_iflag()
Xiao Yang [Thu, 6 Aug 2020 02:13:36 +0000 (10:13 +0800)]
fstests: Use _require_scratch_dax_mountopt() and _require_dax_iflag()

1) Make related tests use _require_scratch_dax_mountopt() and _require_dax_iflag().
2) Remove unused _require_scratch_dax().

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agocommon/rc: Introduce helpers for new dax mount options and FS_XFLAG_DAX
Xiao Yang [Thu, 6 Aug 2020 02:13:35 +0000 (10:13 +0800)]
common/rc: Introduce helpers for new dax mount options and FS_XFLAG_DAX

1) _check_scratch_dax_mountopt() checks old/new dax mount option and
   returns a value.
2) _require_scratch_dax_mountopt() throws notrun if _check_scratch_dax_mountopt()
   returns a non-zero value.
3) _require_dax_iflag() checks FS_XFLAG_DAX.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agogeneric/452: Fix the wrong commit id
Xiao Yang [Wed, 29 Jul 2020 05:17:01 +0000 (13:17 +0800)]
generic/452: Fix the wrong commit id

The mentioned commit 42d4a99b09cb doesn't exist so use the correct one.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agoext4: Test read-only external journal device
Lukas Czerner [Mon, 27 Jul 2020 10:26:18 +0000 (12:26 +0200)]
ext4: Test read-only external journal device

We should never be able to mount ext4 file system read-write with
read-only external journal device. Test it.

This problem has been addressed with proposed kernel patch
https://lore.kernel.org/linux-ext4/20200717090605.2612-1-lczerner@redhat.com/

The test was based on generic/050.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agogeneric/062: use more restrictive filter when querying for attributes
Jeff Layton [Wed, 5 Aug 2020 13:53:08 +0000 (09:53 -0400)]
generic/062: use more restrictive filter when querying for attributes

Sometimes we can end up with unexpected xattrs showing up on an inode.
For instance, on an SELinux-enabled host security.selinux may be set and
show up in a listing even though we've never set it.

generic/062 lists out all of the xattrs on an inode in some cases, but
it can't easily account for these "automatic" xattrs being set. Change
it to use a more restrictive regex when filtering attributes, so that we
just get the namespaces we're interested in.

Cc: Zorro Lang <zlang@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agogeneric/377: filter out xattrs that don't start with 'user.'
Jeff Layton [Wed, 5 Aug 2020 13:53:07 +0000 (09:53 -0400)]
generic/377: filter out xattrs that don't start with 'user.'

Most hosts that I've been testing on seem to display security.selinux in
listxattr. 377.out doesn't account for that so it routinely fails for me
in testing.

When testing the output of listxattr in generic/377, filter out any xattr
names that don't start with 'user.'. That should help ensure consistent
output on SELinux-enabled hosts.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agoxfs/263: filters to accommodate new xfs_quota state command and prevent regression
Bill O'Donnell [Mon, 3 Aug 2020 13:46:00 +0000 (08:46 -0500)]
xfs/263: filters to accommodate new xfs_quota state command and prevent regression

New xfs_quota kernel and xfsprogs add grace timers for group and project,
in addition to user quota. Adjust xfs/263 to accommodate those
changes, and avoid regression.

Signed-off-by: Bill O'Donnell <billodo@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agoxfs/{050,299}: clear quota warnings in between checks
Darrick J. Wong [Thu, 30 Jul 2020 18:34:38 +0000 (11:34 -0700)]
xfs/{050,299}: clear quota warnings in between checks

Both of these quota tests contain the output of the xfs_quota repquota
command in the golden output.  Unfortunately, the output was recorded
before quota soft warnings were implemented, which means they'll regress
the output when we make quota warning work.  Fix this by resetting the
warning count to zero before generating output.

While we're at it, use $XFS_QUOTA_PROG instead of xfs_quota.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agoxfs/{263,106}: erase max warnings printout
Darrick J. Wong [Thu, 30 Jul 2020 18:35:33 +0000 (11:35 -0700)]
xfs/{263,106}: erase max warnings printout

Both of these tests encode the xfs_quota output in the golden output.
Now that we've changed xfs_quota to emit max warnings, we have to fix
the test to avoid regressions.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agoxfs/518: modify timer/state commands to remove new g,p timer output
Bill O'Donnell [Fri, 31 Jul 2020 17:37:39 +0000 (12:37 -0500)]
xfs/518: modify timer/state commands to remove new g,p timer output

New xfs_quota kernel and xfsprogs add grace timers for group and project,
in addition to existing user quota. Adjust xfs/518 to accommodate those
changes, and avoid regression.

Signed-off-by: Bill O'Donnell <billodo@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agobtrfs: Add test to check if shrink works well with fstrim
Qu Wenruo [Thu, 30 Jul 2020 12:17:35 +0000 (20:17 +0800)]
btrfs: Add test to check if shrink works well with fstrim

There is a bug in trim code which leads to fstrim accessing beyond
device boundary.

The test case will check if fstrim, then shrink, then fstrim, all of
them works without problem.

The fix is titled "btrfs: trim: fix underflow in trim length to prevent
access beyond device boundary".

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agoxfs/030: repair should actually find the zeroed block pointer in the agfl
Darrick J. Wong [Wed, 29 Jul 2020 16:14:43 +0000 (09:14 -0700)]
xfs/030: repair should actually find the zeroed block pointer in the agfl

In xfs/030, we zero the entire AGFL which makes it corrupt because the
AG superblock block is /never/ free.  In commit dcd6c2e1 ("xfs_repair:
convert to libxfs_verify_agbno") we enhanced repair to complain about
zeroed entries in the AGFL, so add that to the golden output.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
15 months agogeneric/603: don't run on XFS v4 filesystems
Darrick J. Wong [Wed, 29 Jul 2020 02:51:41 +0000 (19:51 -0700)]
generic/603: don't run on XFS v4 filesystems

XFS filesystems require V5 format to support all three quota types at
the same time, so skip the test if we're testing XFS older than that.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agobtrfs/162: Stop using device mount option
Nikolay Borisov [Fri, 24 Jul 2020 13:12:50 +0000 (16:12 +0300)]
btrfs/162: Stop using device mount option

btrfs is clever enough to figure out which devices constitute the
sprout fs even without specifying them explicitly with -o device.
Additionally, explicitly settings the devices via -o device reduces
coverage of the test since it didn't detect breakage a local change
introduced. Without -o device instead this breakage was detected.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agogeneric/501: make the test work on machines with a non 4K page size
Filipe Manana [Wed, 22 Jul 2020 14:12:54 +0000 (15:12 +0100)]
generic/501: make the test work on machines with a non 4K page size

Currently generic/501 fails on machines with a page size different from 4K
(like ppc64le), because the clone operation fails with -EINVAL due to the
fact we pass it an offset that is 4K aligned but not aligned to the page
size of the machine.

The test doesn't actually need offsets and lengths to be 4K aligned, so
just update the test to use offsets and lenghts that work for page size.
Also add a comment mentioning that a file size of at least 16Mb was a
necessary condition to trigger the btrfs bug.

The test is a regression test for a btrfs issue fixed by kernel commit
bd3599a0e142cd ("Btrfs: fix file data corruption after cloning a range
and fsync"), which landed in kernel 4.18.

Since I couldn't compile a 4.17 kernel on debian testing, I tried this
with a 4.18 kernel with that commit reverted, and it fails as expected
on a x86_64 box:

$ ./check generic/501
FSTYP         -- btrfs
PLATFORM      -- Linux/x86_64 debian9 4.18.0-btrfs-next-64 #1 SMP (...)
MKFS_OPTIONS  -- /dev/sdc
MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1

generic/501 1s ... - output mismatch (see .../xfstests/results//generic/501.out.bad)
    --- tests/generic/501.out 2020-07-22 14:50:12.585674202 +0100
    +++ /home/fdmanana/git/hub/xfstests/results//generic/501.out.bad ...
    @@ -2,4 +2,4 @@
     File bar digest before power failure:
     69319d0343ab8f5ea564167da445addc  SCRATCH_MNT/bar
     File bar digest after power failure:
    -69319d0343ab8f5ea564167da445addc  SCRATCH_MNT/bar
    +21de7d7325fe4dae1f3311d5a76f819f  SCRATCH_MNT/bar
    ...
    (Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/generic/501.out ...
Ran: generic/501
Failures: generic/501
Failed 1 of 1 tests

Without the commit reverted it passes as expected.

Reported-by: Murphy Zhou <jencce.kernel@gmail.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agobtrfs/210: Ignore output from "quota rescan" after "quota enable"
Marcos Paulo de Souza [Tue, 21 Jul 2020 12:46:30 +0000 (09:46 -0300)]
btrfs/210: Ignore output from "quota rescan" after "quota enable"

Command "quota enable" triggers a quota rescan, but it can finish
quick in some machines leading to the next command "quota rescan" to
be able to start scanning again, and then printing "quota rescan
started" making the test fail.

In some machines this don't happen because the first rescan
initiated by "quota enable" is still running when "quota rescan" is
executed, returning -EINPROGRESS from ioctl
BTRFS_IOC_QUOTA_RESCAN_STATUS and not printing the message.

Ignoring any output from "quota rescan" solves the issue in both
cases, and this is already being done by others tests as well.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agogeneric: add missing runtime checks for mknod/mkfifo
Vladimir Zapolskiy [Tue, 21 Jul 2020 09:38:30 +0000 (12:38 +0300)]
generic: add missing runtime checks for mknod/mkfifo

Some generic tests explicitly run 'mknod' or 'mkfifo' command, however
the correspondent runtime check is missing, this results in a test
failure instead of selecting not to execute the test.

The change adds _require_mknod check to the next generic tests:

  * generic/157
  * generic/158
  * generic/294
  * generic/423

Signed-off-by: Vladimir Zapolskiy <vladimir@tuxera.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agogeneric: associate a few tests with punch and zero test groups
Vladimir Zapolskiy [Tue, 21 Jul 2020 09:38:09 +0000 (12:38 +0300)]
generic: associate a few tests with punch and zero test groups

In runtime the modified tests requires and utilizes fpunch command
of xfs_io, thus a tested filesystem shall support the feature and
running a filesystem check by "punch" group selection should include
these tests:

  * generic/176
  * generic/415
  * generic/447
  * generic/469
  * generic/562

In addition and due to the same reasons add generic/469 to zero test
group, the test already contains _require_xfs_io_command "fzero" check.

Signed-off-by: Vladimir Zapolskiy <vladimir@tuxera.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agogeneric: add a test for umount racing mount
Boris Burkov [Mon, 20 Jul 2020 19:05:56 +0000 (12:05 -0700)]
generic: add a test for umount racing mount

Test if dirtying many inodes (which can delay umount) then
unmounting and quickly mounting again causes the mount to fail.

A race, which breaks the test in btrfs, is fixed by kernel commit
48cfa61b58a1 ("btrfs: fix mount failure caused by race with umount")

Signed-off-by: Boris Burkov <boris@bur.io>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agobtrfs: test if show_devname returns sprout device
Anand Jain [Mon, 20 Jul 2020 03:55:54 +0000 (11:55 +0800)]
btrfs: test if show_devname returns sprout device

Test if the show_devname() returns sprout device instead of seed device.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agooverlay: add unionmount tests with nested overlay
Amir Goldstein [Sun, 31 May 2020 11:01:56 +0000 (14:01 +0300)]
overlay: add unionmount tests with nested overlay

These tests use an overlay mount as lower layer for a nested overlay.
That provides test coverage for a lower layer with null uuid and
lower layer with real inode numbers that use the high xino bits.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agooverlay: add unionmount tests with multi lower layers
Amir Goldstein [Sun, 31 May 2020 11:01:55 +0000 (14:01 +0300)]
overlay: add unionmount tests with multi lower layers

The tests with multi lower layers rotate the upper layer into a lower
layer on specific operations such as mkdir, rename and link.
That provides test coverage for redirect_dir and index features.

The following variations are covered:
1. All layers all on scratch fs (--ov=10 --samefs)
2. All layers on scratch fs expect for lowermost on test fs (--ov=10)
3. Lowermost layer on test fs, one layer on tmpfs and the rest
   on sratch fs (--ov=10 --maxfs=1)
4. Lowermost layer on test fs, one layer on scratch fs and the rest
   are unique tmpfs instances (--ov=10 --maxfs=10)

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agooverlay: run unionmount testsuite test cases
Amir Goldstein [Sun, 31 May 2020 11:01:54 +0000 (14:01 +0300)]
overlay: run unionmount testsuite test cases

Add support for running unionmount-testsuite from xfstests.
This requires that unionmount-testsuite is installed under src dir or
that UNIONMOUNT_TESTSUITE variable points to the location of the
testsuite.  It also requires a recent version of unionmount-testsuite
that supports setting basedir path via UNIONMOUNT_* environment variables.

Add tests for three basic configurations:
1. overlay with upper/lower on same fs
2. overlay with upper/lower not on same fs without xino
3. overlay with upper/lower not on same fs with xino

The samefs test uses scratch partition for lower/upper layers.
The non samefs tests use the scratch partition for upper layer and the
test partition for lower layer.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agogeneric/587: associate the test with quota test group
Vladimir Zapolskiy [Fri, 17 Jul 2020 11:09:36 +0000 (14:09 +0300)]
generic/587: associate the test with quota test group

The test checks regressions on quota accounting and therefore it relies
on quota support by a tested filesystem, this makes it reasonable to
include the test into 'quota' test group for better managing of test
groups.

Signed-off-by: Vladimir Zapolskiy <vladimir@tuxera.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agogeneric: fix insert test group associations
Vladimir Zapolskiy [Fri, 17 Jul 2020 08:22:07 +0000 (11:22 +0300)]
generic: fix insert test group associations

The change makes one-in-one correspondence between generic tests in
'insert' test group and tests with $(_require_xfs_io_command "finsert")
runtime check:

* generic/348 -- insert group association is removed,
* generic/458 -- insert group association is added.

The intention of the change is to get better summarized association
between tests and test groups to be able to operate with test groups
in a better way.

Signed-off-by: Vladimir Zapolskiy <vladimir@tuxera.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agocheck: clear WARN_ONCE state before each test
Lukas Czerner [Wed, 15 Jul 2020 11:42:19 +0000 (13:42 +0200)]
check: clear WARN_ONCE state before each test

clear WARN_ONCE state before each test to allow a potential problem
to be reported for each test

[Eryu: replace "/sys/kernel/debug" with $DEBUGFS_MNT ]

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agogeneric/038: assign the test to trim group of tests
Vladimir Zapolskiy [Wed, 15 Jul 2020 13:08:38 +0000 (16:08 +0300)]
generic/038: assign the test to trim group of tests

The test runs fstrim utility to stress a filesystem, however it implies
that the filesystem supports ioctl(FITRIM), this is checked in runtime by
_require_batched_discard() in the test itself, however the assignment of
the test to trim group is missing.

The intention of the change is to get better association between tests
and test groups.

Signed-off-by: Vladimir Zapolskiy <vladimir@tuxera.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agogeneric/079: remove assignment of the test to acl and attr groups
Vladimir Zapolskiy [Mon, 13 Jul 2020 12:26:48 +0000 (15:26 +0300)]
generic/079: remove assignment of the test to acl and attr groups

The test does not belong to acl group of tests, and expectedly the test
is supposed to pass on a filesystem which supports file attributes but
not ACLs.

In addition the test should be removed from attr group of tests, because
the attr group specifies tests which operate over extended file attributes,
this test does not fall into this category.

The change is intended to improve the assignment of tests to groups
to get better testing coverage, if a list of run tests is selected by
test group attributes.

Signed-off-by: Vladimir Zapolskiy <vladimir@tuxera.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agogeneric: assign a number of tests to attr group
Vladimir Zapolskiy [Mon, 13 Jul 2020 12:26:28 +0000 (15:26 +0300)]
generic: assign a number of tests to attr group

A few generic tests have a _require_attrs runtime check for support
of extended file attributes by a tested filesystem, review shows that
the tests listed below are definitely using extended file attributes,
thus this implies that the tested filesystem should provide support of
the feature in general.

Adding the tests explicitly to attr group of tests allows to get a better
granularity of selecting or deselecting tests by groups in accordance to
extended file attributes feature given by a filesystem, the change affects
the next list of tests:

  * generic/037
  * generic/066
  * generic/103
  * generic/337
  * generic/449

Signed-off-by: Vladimir Zapolskiy <vladimir@tuxera.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agogeneric: reorder output to stderr and stdout from _scratch_mkfs
Vladimir Zapolskiy [Sat, 11 Jul 2020 09:23:19 +0000 (12:23 +0300)]
generic: reorder output to stderr and stdout from _scratch_mkfs

The change fixes false positives from generic/554 and generic/565 tests,
when supplementary output of an mkfs utility to stderr apprears to be mixed
into the test output, which results into non-empty diff with the expected
output found in *.out files.

The change unifies _scratch_mkfs redirections among all generic tests, these
two modified tests are the only ones with the swapped order of output
redirections.

Signed-off-by: Vladimir Zapolskiy <vladimir@tuxera.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agocommon/rc: fix false positives due to leaked mkfs output to stderr
Vladimir Zapolskiy [Fri, 10 Jul 2020 14:13:50 +0000 (17:13 +0300)]
common/rc: fix false positives due to leaked mkfs output to stderr

The change fixes false positives reported by a few generic tests under
circumstances, when an mkfs utility prints its output to stderr and then it
appears in produced *.out files. The change is intended to fix such issues
in the tests, which utilize _require_scratch_swapfile().

Signed-off-by: Vladimir Zapolskiy <vladimir@tuxera.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agogeneric/530: Require metadata journaling
Jan Kara [Thu, 9 Jul 2020 09:57:53 +0000 (11:57 +0200)]
generic/530: Require metadata journaling

Test generic/530 doesn't make sence without metadata journalling as in
that case, there's no way to recover shutdown fs besides fsck. ext4
can be configured without a journal and it supports shutdown ioctl even
in that mode which makes this test fail for that configuration. Add
requirement for metadata journalling to this test so that it's properly
skipped.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agoxfs/518: require scratch device
Darrick J. Wong [Thu, 9 Jul 2020 15:36:55 +0000 (08:36 -0700)]
xfs/518: require scratch device

This test requires the scratch device, so we need to test for it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agocheck: add CLI option to repeat tests
Dave Chinner [Wed, 8 Jul 2020 05:35:13 +0000 (15:35 +1000)]
check: add CLI option to repeat tests

Frequently when trying to reproduce a problem I want to run a set of
specific tests in a loop, over and over again. I run fstests from a
set of run scripts that have non-trivial overhead (e.g. patterning
block devices before the runs start), so if all I want to do is run
the same test 100x, using a shell loop over the entire run
scripts reduces the iteration rate substantially.

Hence add an option to check to allow fstests to loop a number of
times over the configured test set without stopping.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agoxfs: add test for CVE-2020-12655
Gao Xiang [Wed, 24 Jun 2020 01:06:30 +0000 (09:06 +0800)]
xfs: add test for CVE-2020-12655

Add a regression test to see if kernel hangs in order to
look after CVE-2020-12655 and check if the corresponding
fix is applied as well.

Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agobtrfs: test that corruption counter is incremented correctly
Nikolay Borisov [Thu, 2 Jul 2020 14:38:23 +0000 (17:38 +0300)]
btrfs: test that corruption counter is incremented correctly

This patch ensures device corrupted counter is being modified when we try to
read broken data.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agogeneric: test per-type quota softlimit enforcement timeout
Zorro Lang [Sun, 5 Jul 2020 12:28:42 +0000 (20:28 +0800)]
generic: test per-type quota softlimit enforcement timeout

Set different block & inode grace timers for user, group and project
quotas, then test softlimit enforcement timeout, make sure different
grace timers as expected.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agoxfs/516: Use scratch_xfs_get/set_sb_field api
Yang Xu [Tue, 30 Jun 2020 06:23:07 +0000 (14:23 +0800)]
xfs/516: Use scratch_xfs_get/set_sb_field api

When using old xfsprogs, this case fails as below:
    +write: invalid option -- 'd'

xfs_db write command support -d options since xfsprogs commit
86769b32d01 ("xfs_db: allow recalculating CRCs on invalid metadata").
For avoid invalid error, use scratch_xfs_set_sb_field api instead.

Also add missing "rm -f $seqres.full" at the beginning of the test.

Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
16 months agogeneric/361: disable xfs metadata io error retries
Darrick J. Wong [Wed, 24 Jun 2020 03:52:54 +0000 (20:52 -0700)]
generic/361: disable xfs metadata io error retries

This test examines the behavior of xfs when the underlying filesystem is
a sparse image on the scratch filesystem when the scratch fs is about to
run out of space.  Unfortunately, the test assumes that the scratch fs
will ENOSPC on the large data write.  It's possible that metadata
writeback will hit ENOSPC instead, and if we do, the test will hang
forever while xfs retries the write.  Make sure we're set up to fail
fast so that we don't hang the test appliance.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
17 months agogeneric/270: wait for fsstress processes to be killed
Lukas Czerner [Mon, 15 Jun 2020 10:52:36 +0000 (12:52 +0200)]
generic/270: wait for fsstress processes to be killed

Currently wait will do nothing, because $pid is empty due to the fact
that the command was ran on the background in a separate shell so we
never got the $! set.

This is causing unexpected test failures especially under low memory
due to the fact that the fsstress is still running when we are
checking and comparing quota usage.

Fix it by using -w argument for killall that will wait for all processes
to actually die before it exits.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
17 months agooverlay: regression test for two file handle bugs
Amir Goldstein [Sun, 14 Jun 2020 07:01:09 +0000 (10:01 +0300)]
overlay: regression test for two file handle bugs

Test two overlayfs file handle bugs:

 1. Failure to query file handle size
    Fixed by kernel commit 144da23beab8:
        ovl: return required buffer size for file handles

 2. Kernel OOPS on open by hand crafted malformed file handle
    Fixed by kernel commit 9aafc1b01873:
        ovl: potential crash in ovl_fid_to_fh()

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
17 months agoopen_by_handle: add option -z to query file handle size
Amir Goldstein [Sun, 14 Jun 2020 07:01:08 +0000 (10:01 +0300)]
open_by_handle: add option -z to query file handle size

Instead of using MAX_HANDLE_SZ, query the filesystem buffer size
and use that buffer size to get the file handle.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
17 months agogeneric/471: adapt test when running on btrfs to avoid failure on RWF_NOWAIT write
Filipe Manana [Fri, 12 Jun 2020 14:06:03 +0000 (15:06 +0100)]
generic/471: adapt test when running on btrfs to avoid failure on RWF_NOWAIT write

This test currently always fails on btrfs:

generic/471 2s ... - output mismatch (see ...results//generic/471.out.bad)
    --- tests/generic/471.out   2020-06-10 19:29:03.850519863 +0100
    +++ /home/fdmanana/git/hub/xfstests/results//generic/471.out.bad   ...
    @@ -2,12 +2,10 @@
     pwrite: Resource temporarily unavailable
     wrote 8388608/8388608 bytes at offset 0
     XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
    -RWF_NOWAIT time is within limits.
    +pwrite: Resource temporarily unavailable
    +(standard_in) 1: syntax error
    +RWF_NOWAIT took  seconds

This is because btrfs is a COW filesystem and an attempt to write into a
previously written file range allocating a new extent (or multiple).
The only exceptions are when attempting to write to a file range with a
preallocated/unwritten extent or when writing to a NOCOW file that has
extents allocated in the target range already.

The test currently expects that writing into a previously written file
range succeeds, but that is not true on btrfs since we are not dealing
with a NOCOW file. So to make the test pass on btrfs, set the NOCOW bit
on the file when the filesystem is btrfs.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
17 months agocommon/dmthin: modify DMTHIN_POOL_NAME
Jeffle Xu [Fri, 12 Jun 2020 05:18:20 +0000 (13:18 +0800)]
common/dmthin: modify DMTHIN_POOL_NAME

_dmthin_set_queue() gets $cluster_size by 'dmsetup table | grep
$DMTHIN_POOL_NAME'. The original name 'thin-pool' is accidently
the same as the fourth field of the output of 'dmsetup table'.

For example,
vg-pool-tpool: 0 64864256 thin-pool 252:0 252:1 128 0 0

Thus if there is other thin-pool in the test environment, except
for the thin-pool created by _dmthin_init(), the parsed $cluster_size
may be a multi-line string, which is unexpected.

This issue caused a failure of generic/347 and generic/500, while the
dmesg reports 'Invalid argument count'.

Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
17 months agocommon/fuzzy: try to clear blocking flags first in _scratch_fuzz_modify
Gao Xiang [Fri, 12 Jun 2020 01:40:18 +0000 (09:40 +0800)]
common/fuzzy: try to clear blocking flags first in _scratch_fuzz_modify

When stressing xfs/083, I found it sometimes fails as the following:

+++ touch 50000 files
setfattr: /home/fsgqa/scratchmnt/INOBT/20627: Operation not permitted
./common/fuzzy: line 18: /home/fsgqa/scratchmnt/INOBT/20627: Operation not permitted
mv: cannot move '/home/fsgqa/scratchmnt/INOBT/20627' to '/home/fsgqa/scratchmnt/INOBT/20627.longer': Operation not permitted
...
xfs_repair did not fix everything

It's simply that INOBT/20627 was an immutable file generated from
fuzzing. Therefore, this patch tries to clear append, immutable flag
first before modification. Note that it clears dax flag as well
since it prevents immutable flag from clearing.

Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
17 months agoREADME: add note about 123456-fsgqa user creation step
Aurelien Aptel [Thu, 11 Jun 2020 12:41:33 +0000 (14:41 +0200)]
README: add note about 123456-fsgqa user creation step

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>