xfstests-dev.git
10 months agosrc/dmiperf: Remove obsolete dmiperf
Xiao Yang [Wed, 9 Dec 2020 05:08:15 +0000 (13:08 +0800)]
src/dmiperf: Remove obsolete dmiperf

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>
11 months agooverlay: run unionmount tests with custom overlay mount options
Amir Goldstein [Sat, 19 Dec 2020 10:47:27 +0000 (12:47 +0200)]
overlay: run unionmount tests with custom overlay mount options

Assign $OVERLAY_MOUNT_OPTIONS to UNIONMOUNT_MNTOPTIONS and require
that unionmount supports UNIONMOUNT_MNTOPTIONS if OVERLAY_MOUNT_OPTIONS
was provided.

For example, when the mount option metacopy=on is set in
$OVERLAY_MOUNT_OPTIONS, it enables the --meta test option and affects
the test verifications after copy up.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
11 months agoshared/032: add options for jffs2
Su Yue [Sat, 19 Dec 2020 09:10:58 +0000 (17:10 +0800)]
shared/032: add options for jffs2

Recently I found that my disk space was eaten by results/shared/032.full
after one round of xfstests running. The file was filled with binary
bytes by the command:
`mkfs -t jffs2 /dev/mapper/test-2 >> results/shared/032.full 2>&1`

Manual of mkfs.jffs2:
========================================================================
The program mkfs.jffs2 creates a JFFS2 (Second Journalling Flash
File System) file system image and writes the resulting image to the
file specified by the -o option or by default to the standard output,
unless the standard output is a terminal device in which case mkfs.jffs2
will abort. The file system image is created using the files and
directories contained in the directory specified by the option -r or
the present directory, if the -r option is not specified.
========================================================================

So the command equals to
`mkfs -t jffs2 -r xfstests-dev /dev/mapper/test-2 \
    -o xfstests-dev/results/shared/032.full \
    >>xfstests-dev/results/shared/032.full 2>&1`

The output image 032.full is under the directory xfstests-dev.
mkfs.jffs2 keeps reading from 032.full in page size and append bytes
to 032.full until the disk where xfstests-devel located is full.

Fix it by setting @preargs to '-r /proc/fs -o' for jffs2, now the output
is $SCRATCH_DEV. Since mkfs.jffs2 doesn't check overwrite case, just
skip overwrite attempt.

Signed-off-by: Su Yue <l@damenly.su>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
11 months agobtrfs: test incremental send after removing a directory and all its files
Filipe Manana [Thu, 10 Dec 2020 12:09:17 +0000 (12:09 +0000)]
btrfs: test incremental send after removing a directory and all its files

Test that an incremental send operation succeeds, and produces the
correct results, after removing a directory and all its files, unmounting
the filesystem, mounting the filesystem again and creating a new file (or
directory).

This currently fails on btrfs, but is fixed by a patch that has the
following subject:

  btrfs: send, fix wrong file path when there is an inode with a pending rmdir

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
11 months agobtrfs: test if rename handles dir item collision correctly
ethanwu [Tue, 15 Dec 2020 03:59:06 +0000 (11:59 +0800)]
btrfs: test if rename handles dir item collision correctly

This is a regression test for the issue fixed by the kernel commit titled
"btrfs: correctly calculate item size used when item key collision happens"

In this case, we'll simply rename many forged filename that cause collision
under a directory to see if rename failed and filesystem is forced readonly.

Signed-off-by: ethanwu <ethanwu@synology.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
11 months agosrc/t_enospc.c: Fix an error for the loop initialization declaration
Feiyu Zhu [Thu, 10 Dec 2020 02:59:54 +0000 (21:59 -0500)]
src/t_enospc.c: Fix an error for the loop initialization declaration

When I compiled xfstests using the gcc(version 4.8.5), the following error occurred:
t_enospc.c: In function 'enospc_test':
t_enospc.c:88:2: error: 'for' loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < size; i++) {
  ^

Signed-off-by: Feiyu Zhu <zhufy.jy@cn.fujitsu.com>
Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
11 months agogeneric/563: use a loop device to avoid partition incompatibility
Brian Foster [Mon, 14 Dec 2020 17:18:54 +0000 (12:18 -0500)]
generic/563: use a loop device to avoid partition incompatibility

cgroup writeback accounting does not track partition level
statistics. Instead, I/O is accounted against the parent device. As
a result, the test fails if the scratch device happens to be a
device partition. Since parent level stats are potentially polluted
by factors external to the test, wrap the scratch device in a
loopback device to guarantee the test always runs on a top-level
block device.

Reported-by: Boyang Xue <bxue@redhat.com>
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
11 months agogeneric: test for creating duplicate filenames in encrypted dir
Eric Biggers [Mon, 14 Dec 2020 23:47:20 +0000 (15:47 -0800)]
generic: test for creating duplicate filenames in encrypted dir

Test for a race condition where a duplicate filename could be created in
an encrypted directory while the directory's encryption key was being
added concurrently.

generic/595 was already failing on ubifs due to this bug, but only by
accident.  This new test detects the bug on both ext4 and ubifs.  I
wasn't able to get it to detect the bug on f2fs.

Signed-off-by: Eric Biggers <ebiggers@google.com>
11 months agosrc/multi_open_unlink: Stop using attr_set
Xiao Yang [Wed, 9 Dec 2020 05:08:16 +0000 (13:08 +0800)]
src/multi_open_unlink: Stop using attr_set

Avoid the following warning by replacing deprecated
attr_set with setxattr:
---------------------------------------------------
warning: 'attr_set' is deprecated: Use setxattr or lsetxattr instead [-Wdeprecated-declarations]
---------------------------------------------------

Also remove unneeded flags, <attr/attributes.h> and $(LIBATTR).

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>
11 months agogeneric: Add test to check for mounting a huge sparse dm device
Ritesh Harjani [Wed, 9 Dec 2020 04:03:41 +0000 (09:33 +0530)]
generic: Add test to check for mounting a huge sparse dm device

Add this test to check for regression which was reported when ext4 bmap
aops was moved to use iomap APIs. jbd2 calls bmap() kernel function
from fs/inode.c which was failing since iomap_bmap() implementation earlier
returned 0 for block addr > INT_MAX.
This regression was fixed with following kernel commit [1]
commit b75dfde1212991b24b220c3995101c60a7b8ae74
("fibmap: Warn and return an error in case of block > INT_MAX")
[1]: https://patchwork.ozlabs.org/patch/1279914

w/o the kernel fix we get below errors and mount fails

[ 1461.988701] run fstests generic/613 at 2020-10-27 19:57:34
[ 1530.406645] ------------[ cut here ]------------
[ 1530.407332] would truncate bmap result
[ 1530.408956] WARNING: CPU: 0 PID: 6401 at fs/iomap/fiemap.c:116 iomap_bmap_actor+0x43/0x50
[ 1530.410607] Modules linked in:
[ 1530.411024] CPU: 0 PID: 6401 Comm: mount Tainted: G        W
<...>
[ 1530.511978] jbd2_journal_init_inode: Cannot locate journal superblock
[ 1530.513310] EXT4-fs (dm-1): Could not load journal inode

Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
11 months agobtrfs: Update btrfs/215
Nikolay Borisov [Mon, 7 Dec 2020 09:23:18 +0000 (11:23 +0200)]
btrfs: Update btrfs/215

This patch updates btrfs/215 to work with latest upstream kernel. That's
required since commit 324bcf54c449 ("mm: use limited read-ahead to satisfy read")
changed readahead logic to always issue a read even if the RA pages are
set to 0. This results in 1 extra io being issued so the counts in the
test should be incremented by 1. Also use the opportunity to update the
commit reference since it's been merged in the upstream kernel.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
11 months agoxfs/513: fix the regression caused by mount option uqnoenforce
Kaixu Xia [Mon, 7 Dec 2020 11:41:05 +0000 (19:41 +0800)]
xfs/513: fix the regression caused by mount option uqnoenforce

The mount options uqnoenforce and qnoenforce no longer cause 'usrquota'
to be emitted in /proc/mounts, so there is a regression in xfs/513. Fix
it by using proper output option uqnoenforce.

You'll need kernel commit 237d7887ae72 ("xfs: show the proper user
quota options") to pass the test.

[Eryu: add kernel commit info in commit log]

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
11 months agocheck: source common/rc again if TEST_DEV was recreated
Eryu Guan [Fri, 4 Dec 2020 10:43:53 +0000 (16:13 +0530)]
check: source common/rc again if TEST_DEV was recreated

If TEST_DEV is recreated by check, FSTYP derived from TEST_DEV
previously could be changed too and might not reflect the reality.
So source common/rc again with correct FSTYP to get fs-specific
configs, e.g. common/xfs.

For example, using this config-section config file, and run section
ext4 first then xfs, you can see:

our local _scratch_mkfs routine ...
./common/rc: line 825: _scratch_mkfs_xfs: command not found
check: failed to mkfs $SCRATCH_DEV using specified options

local.config:
[default]
RECREATE_TEST_DEV=true
TEST_DEV=/dev/sda5
SCRATCH_DEV=/dev/sda6
TEST_DIR=/mnt/test
SCRATCH_MNT=/mnt/scratch

[ext4]
MKFS_OPTIONS="-b 4096"
FSTYP=ext4

[xfs]
FSTYP=xfs
MKFS_OPTIONS="-f -b size=4k"

Tested-by: Ritesh Harjani <riteshh@linux.ibm.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
11 months agocommon/rc: Fix _check_s_dax()
Ira Weiny [Fri, 4 Dec 2020 01:45:50 +0000 (17:45 -0800)]
common/rc: Fix _check_s_dax()

There is a conflict with the user visible statx bits 'mount root' and
'dax'.  The kernel is changing the dax bit to correct this conflict.[1]

Adjust _check_s_dax() to use the new bit.  Because DAX tests do not run
on root mounts, STATX_ATTR_MOUNT_ROOT should always be 0.  Therefore,
check for the old flag and fail the test if that occurs.

[1] https://lore.kernel.org/lkml/3e28d2c7-fbe5-298a-13ba-dcd8fd504666@redhat.com/

Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
11 months agogeneric: ENOSPC regression test in a multi-threaded scenario
Pratik Rajesh Sampat [Tue, 1 Dec 2020 13:03:28 +0000 (18:33 +0530)]
generic: ENOSPC regression test in a multi-threaded scenario

Test allocation strategies of the file system and validate space
anomalies as reported by the system versus the allocated by the
program.

The test is motivated by a bug in ext4 systems where-in ENOSPC is
reported by the file system even though enough space for allocations is
available[1].

[1]: https://patchwork.ozlabs.org/patch/1294003

Linux kernel patch series that fixes the above regression:
53f86b170dfa ("ext4: mballoc: add blocks to PA list under same spinlock
              after allocating blocks")
cf5e2ca6c990 ("ext4: mballoc: refactor ext4_mb_discard_preallocations()")
07b5b8e1ac40 ("ext4: mballoc: introduce pcpu seqcnt for freeing PA to
              improve ENOSPC handling")
8ef123fe02ca ("ext4: mballoc: refactor ext4_mb_good_group()")
993778306e79 ("ext4: mballoc: use lock for checking free blocks while
              retrying")

Suggested-by: Ritesh Harjani <riteshh@linux.ibm.com>
Co-authored-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Signed-off-by: Pratik Rajesh Sampat <psampat@linux.ibm.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
11 months agoceph: add a new test for cross quota realms renames
Luis Henriques [Fri, 27 Nov 2020 12:37:42 +0000 (12:37 +0000)]
ceph: add a new test for cross quota realms renames

For the moment cross quota realms renames has been disabled in CephFS
after a bug has been found while renaming files created and truncated.
This allowed clients to easily circumvent quotas.

Link: https://tracker.ceph.com/issues/48203
Signed-off-by: Luis Henriques <lhenriques@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
12 months agogeneric: test XFS forkoff miscalcution on 32-bit platform
Gao Xiang [Tue, 24 Nov 2020 10:11:45 +0000 (18:11 +0800)]
generic: test XFS forkoff miscalcution on 32-bit platform

There is a regression that recent XFS_LITINO(mp) update causes
xfs_attr_shortform_bytesfit() returns maxforkoff rather than 0.

Therefore, one result is
  "ASSERT(new_size <= XFS_IFORK_SIZE(ip, whichfork));"

Add a regression test in fstests generic to look after that since
the testcase itself isn't xfs-specific.

Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
12 months agoxfs/033: use _scratch_xfs_db wrapper
Darrick J. Wong [Wed, 11 Nov 2020 00:43:45 +0000 (16:43 -0800)]
xfs/033: use _scratch_xfs_db wrapper

Use the wrapper instead of open-coding the call.

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>
12 months agomisc: fix _get_file_block_size usage
Darrick J. Wong [Wed, 11 Nov 2020 00:43:39 +0000 (16:43 -0800)]
misc: fix _get_file_block_size usage

Fix these tests that rely on the allocation unit size of a file, which
might not necessarily be the fs block size.

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>
12 months agomisc: fix $MKFS_PROG.$FSTYP usage treewide
Darrick J. Wong [Wed, 11 Nov 2020 00:43:33 +0000 (16:43 -0800)]
misc: fix $MKFS_PROG.$FSTYP usage treewide

Replace all the $MKFS_PROG.$FSTYP invocations with $MKFS_PROG -t $FSTYP.
The mkfs wrapper binary knows how to search the user's $PATH to find the
appropriate mkfs delegate, which the author uses to switch between
development and distro versions of various tools.

Unfortunately, using "$MKFS_PROG.$FSTYP" means that the shell only looks
in the same directory as the mkfs wrapper, which means that we can end
up mixing different tool versions when this is the case.

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>
12 months agocommon/populate: make sure _scratch_xfs_populate puts its files on the data device
Darrick J. Wong [Wed, 11 Nov 2020 00:43:26 +0000 (16:43 -0800)]
common/populate: make sure _scratch_xfs_populate puts its files on the data device

Make sure that _scratch_xfs_populate always installs its files on the
data device even if the test config selects rt by default.

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>
12 months agocheck: run tests in a systemd scope for mandatory test cleanup
Darrick J. Wong [Wed, 11 Nov 2020 00:43:16 +0000 (16:43 -0800)]
check: run tests in a systemd scope for mandatory test cleanup

TLDR: If systemd is available, run each test in its own temporary
systemd scope.  This enables the test harness to forcibly clean up all
of the test's child processes (if it does not do so itself) so that we
can move into the post-test unmount and check cleanly.

I frequently run fstests in "low" memory situations (2GB!) to force the
kernel to do interesting things.  There are a few tests like generic/224
and generic/561 that put processes in the background and occasionally
trigger the OOM killer.  Most of the time the OOM killer correctly
shoots down fsstress or duperemove, but once in a while it's stupid
enough to shoot down the test control process (i.e. tests/generic/224)
instead.  fsstress is still running in the background, and the one
process that knew about that is dead.

When the control process dies, ./check moves on to the post-test fsck,
which fails because fsstress is still running and we can't unmount.
After fsck fails, ./check moves on to the next test, which fails because
fsstress is /still/ writing to the filesystem and we can't unmount or
format.

The end result is that that one OOM kill causes cascading test failures,
and I have to re-start fstests to see if I get a clean(er) run.

So, the solution I present in this patch is to teach ./check to try to
run the test script in a systemd scope.  If that succeeds, ./check will
tell systemd to kill the scope when the test script exits and returns
control to ./check.  Concretely, this means that systemd creates a new
cgroup, stuffs the processes in that cgroup, and when we kill the scope,
systemd kills all the processes in that cgroup and deletes the cgroup.

The end result is that fstests now has an easy way to ensure that /all/
child processes of a test are dead before we try to unmount the test and
scratch devices.  I've designed this to be optional, because not
everyone does or wants or likes to run systemd, but it makes QA easier.

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>
12 months agocommon: extract rt extent size for _get_file_block_size
Darrick J. Wong [Wed, 11 Nov 2020 00:42:59 +0000 (16:42 -0800)]
common: extract rt extent size for _get_file_block_size

_get_file_block_size is intended to return the size (in bytes) of the
fundamental allocation unit for a file.  This is required for remapping
operations like fallocate and reflink, which can only operate on
allocation units.  Since the XFS realtime volume can be configure for
allocation units larger than 1 fs block, we need to factor that in here.

Note that ext* with bigalloc does not allocations to be aligned to the
cluster size, so no update is needed there.

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>
12 months agogeneric: fsx IO_URING direct-IO soak tests
Zorro Lang [Sun, 8 Nov 2020 12:26:23 +0000 (20:26 +0800)]
generic: fsx IO_URING direct-IO soak tests

After fsx supports IO_URING read/write, add a test to do IO_URING
direct-IO test by fsx

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
12 months agogeneric: fsx IO_URING soak tests
Zorro Lang [Sun, 8 Nov 2020 12:26:22 +0000 (20:26 +0800)]
generic: fsx IO_URING soak tests

After fsx supports IO_URING read/write, add a test to do IO_URING
soak test of fsx.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
12 months agosrc/feature: add IO_URING feature checking
Zorro Lang [Sun, 8 Nov 2020 12:26:21 +0000 (20:26 +0800)]
src/feature: add IO_URING feature checking

IO_URING is a new feature for GNU/Linux system, if someone case of
xfstests tests this feature, better to check if current system
supports it, or need _notrun.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
12 months agogeneric: test for non-zero used blocks while writing into a file
Filipe Manana [Mon, 9 Nov 2020 12:01:06 +0000 (12:01 +0000)]
generic: test for non-zero used blocks while writing into a file

Test that if we keep overwriting an entire file, either with buffered
writes or direct IO writes, the number of used blocks reported by stat(2)
is never zero while the writes and writeback are in progress.

This is motivated by a bug in btrfs and currently fails on btrfs only. It
is fixed a patchset for btrfs that has the following patches:

  btrfs: fix missing delalloc new bit for new delalloc ranges
  btrfs: refactor btrfs_drop_extents() to make it easier to extend
  btrfs: fix race when defragging that leads to unnecessary IO
  btrfs: update the number of bytes used by an inode atomically

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
12 months agofscrypt-crypt-util: fix maximum IV size
Eric Biggers [Sun, 15 Nov 2020 03:15:36 +0000 (19:15 -0800)]
fscrypt-crypt-util: fix maximum IV size

In commit 65cd8e8a8e81 ("fscrypt-crypt-util: fix IV incrementing for
--iv-ino-lblk-32") I mistakenly decreased the size of fscrypt_iv to 24
bytes, which is the most that is explicitly needed by any of the IV
generation methods.  However, Adiantum encryption takes a 32-byte IV, so
the buffer still needs to be 32 bytes, with any extra bytes zeroed.

So restore the size to 32 bytes.

This fixes a buffer overread that caused generic/550 and generic/584 to
sometimes fail, depending on the build of the fscrypt-crypt-util binary.
(Most of the time it still worked by chance.)

Fixes: 65cd8e8a8e81 ("fscrypt-crypt-util: fix IV incrementing for --iv-ino-lblk-32")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
12 months agofsstress: remove attr_remove
Darrick J. Wong [Wed, 11 Nov 2020 00:44:56 +0000 (16:44 -0800)]
fsstress: remove attr_remove

attr_remove is deprecated, so replace it with lremovexattr.

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>
12 months agofsstress: stop using attr_set
Darrick J. Wong [Wed, 11 Nov 2020 00:44:49 +0000 (16:44 -0800)]
fsstress: stop using attr_set

attr_set is deprecated, so replace it with lsetxattr.

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>
12 months agofsx: fix strncpy usage error
Darrick J. Wong [Wed, 11 Nov 2020 00:44:43 +0000 (16:44 -0800)]
fsx: fix strncpy usage error

We shouldn't feed sizeof() to strncpy as the string length.  Just use
snprintf, which at least doesn't have the zero termination problems.

In file included from /usr/include/string.h:495,
                 from ../src/global.h:73,
                 from fsx.c:16:
In function 'strncpy',
    inlined from 'main' at fsx.c:2944:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning:
'__builtin_strncpy' specified bound 4096 equals destination size
[-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
    inlined from 'main' at fsx.c:2914:4:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning:
'__builtin_strncpy' specified bound 1024 equals destination size
[-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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>
12 months agogeneric/426: Remove unused opt variable in create_test_files()
Xiao Yang [Tue, 10 Nov 2020 02:25:26 +0000 (10:25 +0800)]
generic/426: Remove unused opt variable in create_test_files()

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>
12 months agoxfs/030: hide the btree levels check errors
Darrick J. Wong [Tue, 27 Oct 2020 19:02:15 +0000 (12:02 -0700)]
xfs/030: hide the btree levels check errors

Newer versions of xfsprogs now complain if the rmap and refcount btree
levels are insane, so hide that error from the golden output.

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>
12 months agoxfs/27[26]: force realtime on or off as needed
Darrick J. Wong [Tue, 27 Oct 2020 19:02:08 +0000 (12:02 -0700)]
xfs/27[26]: force realtime on or off as needed

Certain tests have certain requirements where the realtime parameters
are concerned.  Fix them all.

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>
12 months agoxfs/327: fix inode reflink flag checking
Darrick J. Wong [Tue, 27 Oct 2020 19:02:02 +0000 (12:02 -0700)]
xfs/327: fix inode reflink flag checking

This is a regression test that tried to make sure that repair correctly
clears the XFS inode reflink flag when it detects files that do not
share any blocks.  However, it does this checking by looking at the
(online) lsattr output.  This worked fine during development when we
exposed the reflink state via the stat ioctls, but that has long since
been removed.  Now the only way to check is via xfs_db, so switch it to
use that.

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>
12 months agovarious: replace _get_block_size with _get_file_block_size when needed
Darrick J. Wong [Tue, 27 Oct 2020 19:01:56 +0000 (12:01 -0700)]
various: replace _get_block_size with _get_file_block_size when needed

The _get_file_block_size helper was added so that tests could find out
the size of a fundamental unit of allocation for a given file, which is
necessary for certain fallocate and clonerange tests.

On certain filesystem configurations (ocfs2 with clusters, xfs with a
large rt extent size), this is /not/ the same as the filesystem block
size, and these tests will fail.  Fix them to use the correct helper.

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>
12 months agoxfs/341: fix test when rextsize > 1
Darrick J. Wong [Tue, 27 Oct 2020 19:01:48 +0000 (12:01 -0700)]
xfs/341: fix test when rextsize > 1

Fix this test so that it works when the rt extent size is larger than
single block.

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>
12 months agoxfs/520: disable external devices
Darrick J. Wong [Tue, 27 Oct 2020 19:01:42 +0000 (12:01 -0700)]
xfs/520: disable external devices

This is a regression test for a specific bug that requires a specific
configuration of the data device.  Realtime volumes and external logs
don't affect the efficacy of the test, but the test can fail mkfs if the
realtime device is very large.

Therefore, unset USE_EXTERNAL so that we always run this regression
test, even if the tester enabled realtime.

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>
12 months agogeneric: test number of blocks used by a file after mwrite into a hole
Filipe Manana [Wed, 4 Nov 2020 11:13:37 +0000 (11:13 +0000)]
generic: test number of blocks used by a file after mwrite into a hole

Test that after doing a memory mapped write to an empty file, a call to
stat(2) reports a non-zero number of used blocks.

This is motivated by a bug in btrfs where the number of blocks used does
not change. It currenly fails on btrfs and it is fixed by a patch that
has the following subject:

  "btrfs: fix missing delalloc new bit for new delalloc ranges"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
12 months agosrc/append_reader.c: print more info when it reads bad data
Jeff Layton [Thu, 5 Nov 2020 15:05:43 +0000 (10:05 -0500)]
src/append_reader.c: print more info when it reads bad data

When append_reader gets bad data, print the actual and expected values.
This was helpful to me when hunting a failure in generic/069 on ceph
recently.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
12 months agobtrfs/220: fix how we tests for mount options
Josef Bacik [Wed, 4 Nov 2020 20:38:45 +0000 (15:38 -0500)]
btrfs/220: fix how we tests for mount options

Filipe noticed that btrfs/220 started failing with some mount option
changes I made recently, but upon closer inspection this test actually
fails in a lot of different ways normally, specifically if you specify
MOUNT_OPTIONS, or if you make an fs with the free space tree.

Address all these issues by reworking how we test that the mount options
are what we expect.  First get what the default mount options are for a
plain mount of SCRATCH_DEV.  This is used as the baseline, so no matter
how the mount options change in the future it will always work properly.

Secondly instead of specifying a rigid order of the mount options we're
testing, which breaks if we adjust the order in /proc/self/mounts,
simply specify the options we're actually interested in checking.  Then
in the test function combine the common options with the new options
we're testing, and then combine that with our actual options and use
some sort magic to see if there's any difference.  If there's no
difference then we know we have everything set as expected, if not we
fail.

This patch addresses the initial issue that Filipe noticed, but also
fixes the failures when you specified MOUNT_OPTIONS, or if you made the
fs with the free space tree.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
12 months agotests/ceph: add Makefile
Eric Biggers [Sun, 1 Nov 2020 17:16:19 +0000 (09:16 -0800)]
tests/ceph: add Makefile

'make install' stopped working because the tests/ceph/ directory is
missing a Makefile.  Add it.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Reviewed-by: Vladimir Zapolskiy <vladimir@tuxera.com>
Tested-by: Vladimir Zapolskiy <vladimir@tuxera.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
13 months agogeneric: test that encryption nonces are unique and random
Eric Biggers [Sat, 31 Oct 2020 07:23:44 +0000 (00:23 -0700)]
generic: test that encryption nonces are unique and random

Test that encryption nonces are unique and random, where randomness is
approximated as "incompressible by the xz program".

This gets indirectly tested by generic/399, but there are some gaps.
It's good to test for this directly too.

This test runs and passes on ext4 and f2fs.  It doesn't currently run on
ubifs because _get_encryption_nonce() isn't implemented for ubifs yet.
(At some point I'll probably switch _get_encryption_nonce() to use
FS_IOC_GET_ENCRYPTION_NONCE, which was added in Linux 5.7.  But for now
I'd like to keep the tests using it runnable on older kernels too.)

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
13 months agogeneric/398: remove workarounds for wrong error codes
Eric Biggers [Sat, 31 Oct 2020 05:41:41 +0000 (22:41 -0700)]
generic/398: remove workarounds for wrong error codes

generic/398 contains workarounds to allow for renames of encrypted files
to fail with different error codes.  However, these error codes were
fixed up by kernel commits f5e55e777cc9 ("fscrypt: return -EXDEV for
incompatible rename or link into encrypted dir") and 0c1ad5242d4f
("ubifs: switch to fscrypt_prepare_rename()").

It's been long enough, so update the test to expect the correct behavior
only, so we don't accidentally reintroduce the wrong behavior.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
13 months agogeneric/395: remove workarounds for wrong error codes
Eric Biggers [Sat, 31 Oct 2020 05:40:18 +0000 (22:40 -0700)]
generic/395: remove workarounds for wrong error codes

generic/395 contains workarounds to allow for some of the fscrypt ioctls
to fail with different error codes.  However, the error codes were all
fixed up and documented years ago:

- FS_IOC_GET_ENCRYPTION_POLICY on ext4 failed with ENOENT instead of
  ENODATA on unencrypted files.  Fixed by commit db717d8e26c2
  ("fscrypto: move ioctl processing more fully into common code").

- FS_IOC_SET_ENCRYPTION_POLICY failed with EINVAL instead of EEXIST
  on encrypted files.  Fixed by commit 8488cd96ff88 ("fscrypt: use
  EEXIST when file already uses different policy").

- FS_IOC_SET_ENCRYPTION_POLICY failed with EINVAL instead of ENOTDIR
  on nondirectories.  Fixed by commit dffd0cfa06d4 ("fscrypt: use
  ENOTDIR when setting encryption policy on nondirectory").

It's been long enough, so update the test to expect the correct behavior
only, so we don't accidentally reintroduce the wrong behavior.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
13 months agogeneric/397: remove workarounds for wrong error codes
Eric Biggers [Sat, 31 Oct 2020 05:41:29 +0000 (22:41 -0700)]
generic/397: remove workarounds for wrong error codes

generic/397 contains workarounds to allow for kernel bugs where trying
to open or create files in an encrypted directory without the encryption
key failed with ENOENT, EACCES, or EPERM instead of the expected ENOKEY.

However, all these bugs have been fixed.  ext4 and f2fs were fixed years
ago by commit 54475f531bb8 ("fscrypt: use ENOKEY when file cannot be
created w/o key").  ubifs was fixed by commit b01531db6cec ("fscrypt:
fix race where ->lookup() marks plaintext dentry as ciphertext").

It's been long enough, so update the test to expect the correct behavior
only, so we don't accidentally reintroduce the wrong behavior.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
13 months agofstests: add missing remove of the $seqres.full file for some tests
Filipe Manana [Thu, 29 Oct 2020 12:09:06 +0000 (12:09 +0000)]
fstests: add missing remove of the $seqres.full file for some tests

Some test cases are missing the 'rm -f $seqres.full' line but are appending
to that file, so everytime they run that file gets bigger and bigger (some
of them are using about a dozen megabytes on one of my test boxes).

So just add the 'rm -f $seqres.full' line to them, together with the comment
that the 'new' script generates for new test cases.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
13 months agoext4: Add a test for inline_data vs. DAX inode flag
Xiao Yang [Tue, 27 Oct 2020 02:52:11 +0000 (10:52 +0800)]
ext4: Add a test for inline_data vs. DAX inode flag

Inline_data is mutually exclusive to DAX inode flag so enabling both
of them is not expected and triggers some errors.  It's a regression
test for kernel commit aa2f77920b74 ("ext4: disallow modifying DAX
inode flag if inline_data has been set")

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
13 months agoceph: test copy_file_range with infile = outfile
Luis Henriques [Mon, 19 Oct 2020 13:27:50 +0000 (14:27 +0100)]
ceph: test copy_file_range with infile = outfile

This runs a set of simple tests where the infile file is the same as the
outfile.

Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
13 months agoceph: test combination of copy_file_range with truncate
Luis Henriques [Mon, 19 Oct 2020 13:27:49 +0000 (14:27 +0100)]
ceph: test combination of copy_file_range with truncate

This tests a bug found while testing copy_file_range.  This bug was an
issue with how the OSDs handled the truncate_seq value, which was being
copied from the original object into the destination object.  This test
ensures the kernel client correctly handles fixed/non-fixed OSDs.

Link: https://tracker.ceph.com/issues/37378
Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
14 months 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>
14 months 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>
14 months 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>
14 months 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>
14 months 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>
14 months 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>
14 months 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>
14 months 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>
14 months 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>
14 months 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>
14 months 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>
14 months 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>
14 months 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>
14 months 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>
14 months 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>
14 months 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>
14 months 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>
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>