xfstests-dev.git
23 months agoceph: add copy_file_range (remote copy operation) testing
Luis Henriques [Mon, 19 Oct 2020 13:27:48 +0000 (14:27 +0100)]
ceph: add copy_file_range (remote copy operation) testing

Test remote copy operation (CEPH_OSD_OP_COPY_FROM) with different
combinations of both object sizes and copy sizes.

Test remote copy operation (CEPH_OSD_OP_COPY_FROM) with several
combinations of both object sizes and copy sizes.  It also uses several
combinations of copy ranges.  For example, copying the 1st object in the
src file into:

  1) the beginning (1st object) of dst file,
  2) the end (last object) of dst file and
  3) the middle of the dst file.

Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agocommon/repair: filter unknown block state properly
Zorro Lang [Tue, 27 Oct 2020 04:26:52 +0000 (12:26 +0800)]
common/repair: filter unknown block state properly

xfsprogs 32e11be9 ("xfs_repair: complain about extents in unknown
state") changed the xfs_repair output format as below:

  - _("unknown block state, ag %d, block %d\n"),
  -         i, j);
  + _("unknown block state, ag %d, blocks %u-%u\n"),
  +         i, j, j + blen - 1);

It replaces "block" with "blocks". That cause xfs/030 fails. So use
proper regex to filter the 'old' and 'new' output format both.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agoext4: verify unwritten extent conversion in buff-io
Ritesh Harjani [Thu, 22 Oct 2020 12:16:32 +0000 (17:46 +0530)]
ext4: verify unwritten extent conversion in buff-io

There was an issue where with filesize > 4G, map.m_lblk
was getting overflow in buff-IO path while converting unwritten to
written extent with dioread_nolock mount option with bs < ps.

Adding a testcase to test for such regressions with dioread_nolock
mount option. To reproduce the same regression w/o the fix
in the kernel, test with bs < ps config.

The following commit fixed the issue in linux.

id1e18b8824dd ("ext4: fix bs < ps issue reported with dioread_nolock
mount opt")

Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agobtrfs: add test case for rwf_nowait writes
Filipe Manana [Tue, 20 Oct 2020 14:43:01 +0000 (15:43 +0100)]
btrfs: add test case for rwf_nowait writes

Test several scenarios for RWF_NOWAIT writes, to verify we don't regress
on btrfs specific behaviour (snapshots, cow files, reflinks, holes,
prealloc extent beyond eof).

We had some bugs in the past related to RWF_NOWAIT writes not failing on
btrfs when they should or failing when they shouldn't, these were fixed by
the following kernel commits:

  4b1946284dd6 ("btrfs: fix failure of RWF_NOWAIT write into prealloc extent beyond eof")
  260a63395f90 ("btrfs: fix RWF_NOWAIT write not failling when we need to cow")

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agobtrfs/163: replace sprout instead of seed
Anand Jain [Tue, 20 Oct 2020 12:32:57 +0000 (20:32 +0800)]
btrfs/163: replace sprout instead of seed

Make this test case inline with the kernel patch [1] changes
[1] c6a5d954950c btrfs: fix replace of seed device

So use the sprout device as the replace target instead of the seed device.
This change is compatible with the older kernels.

While at this, this patch also fixes a typo fix as well.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agobtrfs: add a test case for btrfs seed device delete
Anand Jain [Tue, 20 Oct 2020 12:32:56 +0000 (20:32 +0800)]
btrfs: add a test case for btrfs seed device delete

This is a regression test for the issue fixed by the kernel commit
b5ddcffa3777 (btrfs: fix put of uninitialized kobject after seed device
delete).

In this test case, we verify the seed device delete on a sprouted
filesystem.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agocommon/config: Allow environment defined btrfs mkfs options
Goldwyn Rodrigues [Thu, 22 Oct 2020 18:49:24 +0000 (13:49 -0500)]
common/config: Allow environment defined btrfs mkfs options

btrfs does not have options of defining mkfs options via the
environment. Use BTRFS_MKFS_OPTIONS environment variable to set
MKFS_OPTIONS for btrfs.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agocheck: fix misspelled variable name for sections
Filipe Manana [Tue, 20 Oct 2020 14:42:10 +0000 (15:42 +0100)]
check: fix misspelled variable name for sections

We have some places that refer to the variable OPTIONS_HAVE_SECTIONS
has OPTIONS_HAVE_SECIONS, obviously a typo. So fix them.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agooverlay/073: test with nfs_export being off
Murphy Zhou [Fri, 11 Sep 2020 02:18:13 +0000 (10:18 +0800)]
overlay/073: test with nfs_export being off

When nfs_export is enabled, the link count of upper dir
objects are more then the expected number in this testcase.
Because extra index entries are linked to upper inodes.

Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agogeneric/402: Drop useless fail message
Yang Xu [Mon, 19 Oct 2020 03:01:59 +0000 (11:01 +0800)]
generic/402: Drop useless fail message

Here won't be "scratch mount failed" messages when mounting SCRATCH_DEV
failed, because _scratch_mount exits early by invoking the following_fail.

_scratch_mount
{
        _try_scratch_mount $* || _fail "mount failed"
}

The message is useless and redundant. So drop it.

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>
23 months agogeneric/127: to exit if any subtest fails
Matthew Wilcox [Mon, 19 Oct 2020 12:58:39 +0000 (13:58 +0100)]
generic/127: to exit if any subtest fails

If one of the subtests of generic/127 fails, we proceed with the
rest of the tests, potentially overwriting useful data.  This makes
it stop as soon as any of the subtests fails.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agofstests: drop check.log and check.time into section specific results dir
Josef Bacik [Tue, 15 Sep 2020 00:22:43 +0000 (20:22 -0400)]
fstests: drop check.log and check.time into section specific results dir

Right now we only track check.log and check.time globally, it would
be nice to do it per-section as well.  This makes it easier to parse
results from systems that run a bunch of different configurations at
once.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agobtrfs: Add new test for qgroup assign functionality
Sidong Yang [Sun, 11 Oct 2020 06:20:19 +0000 (06:20 +0000)]
btrfs: Add new test for qgroup assign functionality

This new test will test btrfs's qgroup assign functionality. The
test has 3 cases.

 - assign, no shared extents
 - assign, shared extents
 - snapshot -i, shared extents

Each cases create subvolumes and assign qgroup in their own way
and check with the command "btrfs check".

Cc: Qu Wenruo <wqu@suse.com>
Cc: Eryu Guan <guan@eryu.me>
Signed-off-by: Sidong Yang <realwakka@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agoxfs/521: use _try_scratch_mount instead of _scratch_mount
Yang Xu [Fri, 16 Oct 2020 09:31:23 +0000 (17:31 +0800)]
xfs/521: use _try_scratch_mount instead of _scratch_mount

Here will check the return code of mount option. So update it
to use _try_scratch_mount.

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>
23 months agofstests: add a filter for the new getcap output
Filipe Manana [Sun, 11 Oct 2020 12:38:52 +0000 (13:38 +0100)]
fstests: add a filter for the new getcap output

Starting with version 2.41 of libcap, the output of the getcap program
changed and therefore some existing tests fail when the installed version
of libcap is >= 2.41 (the latest version available at the moment is 2.44).

The change was made by the following commit of libcap:

  commit 177cd418031b1acfcf73fe3b1af9f3279828681c
  Author: Andrew G. Morgan <morgan@kernel.org>
  Date:   Tue Jul 21 22:58:05 2020 -0700

      A more compact form for the text representation of capabilities.

      While this does not change anything about the supported range of
      equivalent text specifications for capabilities, as accepted by
      cap_from_text(), this does alter the preferred output format of
      cap_to_text() to be two characters shorter in most cases. That is,
      what used to be summarized as:

         "= cap_foo+..."

      is now converted to the equivalent text:

         "cap_foo=..."

      which is also more intuitive.

So add a filter to change the old format to the new one, an helper that
calls getcap with that filter, make existing tests use the new helper and
update their golden output to match the new output format of getcap.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agogeneric/611: Use _getfattr instead of GETFATTR_PROG
Yang Xu [Sun, 11 Oct 2020 05:51:35 +0000 (13:51 +0800)]
generic/611: Use _getfattr instead of GETFATTR_PROG

When using old version(such as getfattr 2.4.46) getfattr command, it
has the following output,

touch file
setfattr -n user.a file
getfattr --absolute-names -n user.a file
user.a

on new getfattr, it reports the following output,
getfattr --absolute-names -n user.a file
user.a=""

The {=""} will break the golden image, so use _getfattr to filter
the redundant ="" at the end if it has.

Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agoxfs: test running growfs on the realtime volume
Darrick J. Wong [Thu, 8 Oct 2020 15:05:51 +0000 (08:05 -0700)]
xfs: test running growfs on the realtime volume

Make sure that we can run growfs to expand the realtime volume without
it blowing up.  This is a regression test for the following patches:

xfs: Set xfs_buf type flag when growing summary/bitmap files
xfs: Set xfs_buf's b_ops member when zeroing bitmap/summary files
xfs: fix realtime bitmap/summary file truncation when growing rt volume
xfs: make xfs_growfs_rt update secondary superblocks
xfs: annotate grabbing the realtime bitmap/summary locks in growfs

Because the xfs maintainer realized that no, we have no tests for this
particular piece of functionality.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agogeneric/120: add the test to atime test group
Vladimir Zapolskiy [Fri, 9 Oct 2020 11:22:44 +0000 (14:22 +0300)]
generic/120: add the test to atime test group

The test checks "noatime" mount option effect, which makes it reasonable
to include the test into atime test group along with generic/003 and
generic/192 tests.

The test properly depends on _require_atime and for certain filesystems
the test is not run:

    [not run] atime related mount options have no effect on cifs

Signed-off-by: Vladimir Zapolskiy <vladimir@tuxera.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agogeneric: test reflinked file corruption after short COW
Eric Sandeen [Thu, 8 Oct 2020 21:22:13 +0000 (16:22 -0500)]
generic: test reflinked file corruption after short COW

This test essentially creates an existing COW extent which
covers the first 1M, and then does another IO that overlaps it,
but extends beyond it.  The bug was that we did not trim the
new IO to the end of the existing COW extent, and so the IO
extended past the COW blocks and corrupted the reflinked files(s).

The bug came and went upstream.  It was introduced by:

78f0cc9d55cb "xfs: don't use delalloc extents for COW on files with extsize hints"
and (inadvertently) fixed as of:
36adcbace24e "xfs: fill out the srcmap in iomap_begin"
upstream, and in the 5.4 stable tree with:
aee38af574a1 "xfs: trim IO to found COW extent limit"

[Eryu: discard outputs of xfs_io when setting [cow]extsize]

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agoxfs/194: actually check if we got the desired block size before proceeding
Darrick J. Wong [Thu, 8 Oct 2020 03:53:48 +0000 (20:53 -0700)]
xfs/194: actually check if we got the desired block size before proceeding

This test has specific fs block size requirements, so make sure that's
what we got before we proceed with the test.

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>
23 months agof2fs: verify ciphertext of compressed+encrypted file
Eric Biggers [Thu, 1 Oct 2020 00:25:07 +0000 (17:25 -0700)]
f2fs: verify ciphertext of compressed+encrypted file

In Linux v5.6, f2fs added support for per-file compression.  f2fs
compression can be used in combination with the existing f2fs encryption
support (a.k.a. fscrypt), in which case the compressed data is encrypted
rather than the uncompressed data.

We need to verify that the encryption is actually being done as expected
in this case.  So add a test which verifies it.

For now this is a f2fs-specific test.  It's possible that ext4 will
implement compression in the same way as f2fs (in which case this could
be made a generic test), but for now there are no plans for that.

This complements the existing ciphertext verification tests, e.g.
generic/548, which don't handle compression.  Encryption+compression has
some unique considerations, so it requires its own test.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Daeho Jeong <daeho43@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agocommon/f2fs: add _require_scratch_f2fs_compression()
Eric Biggers [Thu, 1 Oct 2020 00:25:06 +0000 (17:25 -0700)]
common/f2fs: add _require_scratch_f2fs_compression()

Create the file common/f2fs, which will contain f2fs-specific utilities.

Then add a function _require_scratch_f2fs_compression(), which checks
for f2fs compression support on the scratch filesystem.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Daeho Jeong <daeho43@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agofscrypt-crypt-util: add --block-number option
Eric Biggers [Thu, 1 Oct 2020 00:25:05 +0000 (17:25 -0700)]
fscrypt-crypt-util: add --block-number option

Currently fscrypt-crypt-util assumes that the number of the first block
encrypted/decrypted is 0.  I.e., it replicates either contents
encryption from the start of a file, or encryption of a filename.

However, to easily test compression+encryption on f2fs, we need the
ability to specify a different starting block number.

Add a --block-number option which does this.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Daeho Jeong <daeho43@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agofscrypt-crypt-util: fix IV incrementing for --iv-ino-lblk-32
Eric Biggers [Thu, 1 Oct 2020 00:25:04 +0000 (17:25 -0700)]
fscrypt-crypt-util: fix IV incrementing for --iv-ino-lblk-32

fscrypt-crypt-util treats the "block number" part of the IV as 64-bit
when incrementing it.  That's wrong for --iv-ino-lblk-32 and
--iv-ino-lblk-64, as in those cases the block number should be 32-bit.

Fix this by using the correct length for the block number.

For --iv-ino-lblk-64 this doesn't actually matter, since in that case
the block number starts at 0 and never exceeds UINT32_MAX.

But for --iv-ino-lblk-32, the hashed inode number gets added to the
original block number to produce the IV block number, which can later
wrap around from UINT32_MAX to 0.  As a result, this change fixes
generic/602, though since the wraparound case isn't specifically tested
currently, the chance of failure was extremely small.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Daeho Jeong <daeho43@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agofscrypt-crypt-util: clean up parsing --block-size and --inode-number
Eric Biggers [Thu, 1 Oct 2020 00:25:03 +0000 (17:25 -0700)]
fscrypt-crypt-util: clean up parsing --block-size and --inode-number

For --block-size, check for strtoul() reporting an overflow.

For --inode-number, check for strtoull() reporting an overflow.

Also, move the check for 32-bit inode numbers into a more logical place
(the place where we check the encryption format-specific limitations).

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Daeho Jeong <daeho43@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agooverlay/071: Don't compare inode numbers in lower overlay and nested overlay
Xiao Yang [Sat, 3 Oct 2020 03:37:35 +0000 (11:37 +0800)]
overlay/071: Don't compare inode numbers in lower overlay and nested overlay

1) If underlying filesystem is ext4, the lower overlay inodes do not
   have the MSB set (e.g. file ino 8590721028 = 0x2000C0004) because
   ext4 has a known inode number limit of 32bit (see ovl_can_decode_fh).
2) With nested xino feature, the nested overlay inodes have the MSB set
   (e.g. file ino 9223372045445496836  = 0x80000002000C0004).
It is expected different inode numbers which casue the failure of
overlay/071, so fix this failure by removing the unneeded comparision.

Suggested-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agooverlay/071: Fix undefined OVL_BASE_SCRATCH_DIR
Xiao Yang [Wed, 30 Sep 2020 05:04:09 +0000 (13:04 +0800)]
overlay/071: Fix undefined OVL_BASE_SCRATCH_DIR

Replace undefined OVL_BASE_SCRATCH_DIR with OVL_BASE_SCRATCH_MNT

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
23 months agobtrfs/064: add a comment to the test case header
Anand Jain [Wed, 30 Sep 2020 04:44:16 +0000 (12:44 +0800)]
btrfs/064: add a comment to the test case header

It appears that the goal of this case was to test balance and
replace concurrency. But these two operations aren't meant to run
concurrently and the replace failing errors are captured in the
seqres.full output. Which are expected errors. To avoid further
confusion, this patch adds comments. The reason to keep this
test case is at the Link.

Link: https://patchwork.kernel.org/patch/11806307/
Reported-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agosrc/t_mmap_dio: do not build if !HAVE_AIO
Eric Sandeen [Thu, 24 Sep 2020 18:21:21 +0000 (13:21 -0500)]
src/t_mmap_dio: do not build if !HAVE_AIO

We have a config check for libaio headers, and don't build certain
tools if it is not present, but this one was missed.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agobtrfs: test fstrim after doing a device replace
Filipe Manana [Wed, 23 Sep 2020 14:31:47 +0000 (15:31 +0100)]
btrfs: test fstrim after doing a device replace

Test that after replacing a device, if we run fstrim against the filesystem
we do not trim/discard allocated chunks in the new device. We verify that
allocated chunks in the new device were not trim/discarded by mounting the
new device only in degraded mode, as this is the easiest way to verify it.

This currently fails on btrfs (since kernel 5.2) and is fixed by a patch
that has the following subject:

  "btrfs: fix filesystem corruption after a device replace"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agobtrfs/125: remove constantly failing test from auto group
Johannes Thumshirn [Wed, 23 Sep 2020 16:44:26 +0000 (01:44 +0900)]
btrfs/125: remove constantly failing test from auto group

The test-case btrfs/125 is often failing due to a design deficiency in
btrfs' RAID5 code.

The details for this can be seen here:
https://lore.kernel.org/linux-btrfs/CAL3q7H4oa70DUhOFE7kot62KjxcbvvZKxu62VfLpAcmgsinBFw@mail.gmail.com/

Remove the test from the auto group until we have a replacement for the
current RAID5/6 code.

Cc: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agobtrfs: remove stale test for alien devices from auto group
Johannes Thumshirn [Mon, 21 Sep 2020 14:30:35 +0000 (23:30 +0900)]
btrfs: remove stale test for alien devices from auto group

btrfs/198 is supposed to be a test for the patch
"btrfs: remove identified alien device in open_fs_devices" but this patch
was never merged in btrfs.

Remove the test from fstests' auto group, as it is constantly failing.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agogeneric/611: remove _supported_os line
Zorro Lang [Mon, 21 Sep 2020 04:31:44 +0000 (12:31 +0800)]
generic/611: remove _supported_os line

The current xfstests doesn't support _supported_os() function, the
generic/611 always hit an error:

  xfstests-dev/tests/generic/611: line 39: _supported_os: command not found

So remove the "_supported_os Linux" line directly.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Pavel Reichl <preichl@redhat.com>
Reviewed-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agoxfs: Add test for too-small device with stripe geometry
Pavel Reichl [Mon, 21 Sep 2020 08:55:11 +0000 (10:55 +0200)]
xfs: Add test for too-small device with stripe geometry

Verify hat an attempt to create a too-small device with stripe geometry,
is handled gracefully instead of hitting an assert in align_ag_geometry()

Signed-off-by: Pavel Reichl <preichl@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agobtrfs: test incremental send after swapping same file with two directories
Filipe Manana [Mon, 21 Sep 2020 13:15:32 +0000 (14:15 +0100)]
btrfs: test incremental send after swapping same file with two directories

Test an incremental send operation after doing a series of changes in a
tree such that one inode gets two hardlinks with names and locations
swapped with two other inodes that correspond to different directories,
and one of these directories is the parent of the other directory.

This currently fails on btrfs, the receive of the incremental send stream
fails. This is fixed by a patchset for btrfs which has two patches with the
following subjects:

  "btrfs: send, orphanize first all conflicting inodes when processing references"
  "btrfs: send, recompute reference path after orphanization of a directory"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agobtrfs: test incremental send after a succession of rename and link operations
Filipe Manana [Mon, 21 Sep 2020 13:15:31 +0000 (14:15 +0100)]
btrfs: test incremental send after a succession of rename and link operations

Test that an incremental send operation emits the correct path for link
and rename operation after swapping the names and locations of several
inodes in a way that creates a nasty dependency of rename and link
operations. Notably one file has its name and location swapped with a
directory for which it used to have a directory entry in it.

This test currently fails but a kernel patch for it exists and has the
following subject:

  "btrfs: send, orphanize first all conflicting inodes when processing references"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agofsx: add IO_URING test
Zorro Lang [Fri, 11 Sep 2020 07:15:55 +0000 (15:15 +0800)]
fsx: add IO_URING test

New IO_URING test for fsx, use -U option to enable IO_URING test.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agofsx: introduce fsx_rw to combine aio_rw with general read and write
Zorro Lang [Fri, 11 Sep 2020 07:15:54 +0000 (15:15 +0800)]
fsx: introduce fsx_rw to combine aio_rw with general read and write

The fsx contains different read and write operations, especially the
AIO and general IO read/write. The fsx chooses one kind of read/write
from AIO and general IO to run. To make the logic clear, use a common
fsx_rw() function to swith between these two kinds of read/write.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agofsstress: fix memory leak in do_aio_rw
Zorro Lang [Fri, 11 Sep 2020 07:15:53 +0000 (15:15 +0800)]
fsstress: fix memory leak in do_aio_rw

If io_submit or io_getevents fails, the do_aio_rw() won't free the
"buf" and cause memory leak.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agofsstress: reduce the number of events when io_setup
Zorro Lang [Fri, 11 Sep 2020 07:15:52 +0000 (15:15 +0800)]
fsstress: reduce the number of events when io_setup

The original number(128) of aio events for io_setup too big. When try
to run lots of fsstress processes(e.g. -p 1000) always hit io_setup
EAGAIN error, due to the nr_events exceeds the limit of available
events. Due to each fsstress process only does once libaio read/write
operation each time. So reduce the aio events number to 1, to make more
fsstress processes can do AIO test.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agofsstress: add IO_URING read and write operations
Zorro Lang [Fri, 11 Sep 2020 07:15:51 +0000 (15:15 +0800)]
fsstress: add IO_URING read and write operations

IO_URING is a new feature of curent linux kernel, add basic IO_URING
read/write into fsstess to cover this kind of IO testing.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agocommon/rc: fix indentation in _scratch_mkfs_sized
Darrick J. Wong [Fri, 18 Sep 2020 02:11:09 +0000 (19:11 -0700)]
common/rc: fix indentation in _scratch_mkfs_sized

Fix the weird indentation in _scratch_mkfs_sized.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agocommon: drop HOSTOS
Darrick J. Wong [Fri, 18 Sep 2020 02:10:22 +0000 (19:10 -0700)]
common: drop HOSTOS

We effectively support only Linux these days, so drop most of the
special casing of HOSTOS.  We'll retain the simple check just in case
someone tries to run this on a different operating system.

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>
2 years agocommon: kill _supported_os
Darrick J. Wong [Fri, 18 Sep 2020 02:09:36 +0000 (19:09 -0700)]
common: kill _supported_os

fstests only supports Linux, so get rid of this unnecessary predicate.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2 years agocheck: try reloading modules
Darrick J. Wong [Fri, 18 Sep 2020 02:06:37 +0000 (19:06 -0700)]
check: try reloading modules

Optionally reload the module between each test to try to pinpoint slab
cache errors and whatnot.

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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>