xfstests-dev.git
8 months agogeneric: test which tries to exercise AIO/DIO into unwritten space
Theodore Ts'o [Mon, 8 Mar 2021 01:22:47 +0000 (20:22 -0500)]
generic: test which tries to exercise AIO/DIO into unwritten space

This test verifies that the an unwritten extent is properly marked as
written after writing into it.

There was a hard-to-hit bug which would occasionally trigger with ext4
for which this test was a reproducer.  This has been fixed after
moving ext4 to use iomap for Direct I/O's, although as of this
writing, there are still some occasional failures on ext4 when block
size < page size.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
8 months agofstests: rename RENAME_WHITEOUT test on fs no enough space
Zorro Lang [Mon, 8 Mar 2021 13:43:27 +0000 (21:43 +0800)]
fstests: rename RENAME_WHITEOUT test on fs no enough space

This's a regression test for linux 6b4b8e6b4ad8 ("ext4: fix bug for
rename with RENAME_WHITEOUT"). Rename a file with RENAME_WHITEOUT
flag might cause corruption when there's not enough space to
complete this renaming operation.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Sun Ke <sunke32@huawei.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
8 months agobtrfs: Add simple stress test when qgroup limits are reached
Nikolay Borisov [Tue, 23 Feb 2021 15:50:42 +0000 (17:50 +0200)]
btrfs: Add simple stress test when qgroup limits are reached

This test uncovered 2 deadlocks with qgroups when their limit was
reached.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
8 months agogeneric: test retrieving verity signature
Eric Biggers [Wed, 24 Feb 2021 22:35:37 +0000 (14:35 -0800)]
generic: test retrieving verity signature

Add a test which tests dumping the built-in signature of a verity file
using the new FS_IOC_READ_VERITY_METADATA ioctl.

Signed-off-by: Eric Biggers <ebiggers@google.com>
8 months agogeneric: test retrieving verity Merkle tree and descriptor
Eric Biggers [Wed, 24 Feb 2021 22:35:36 +0000 (14:35 -0800)]
generic: test retrieving verity Merkle tree and descriptor

Add a test which tests retrieving the Merkle tree and fs-verity
descriptor of a verity file using the new FS_IOC_READ_VERITY_METADATA
ioctl.

Signed-off-by: Eric Biggers <ebiggers@google.com>
8 months agogeneric: add helpers for dumping fs-verity metadata
Eric Biggers [Wed, 24 Feb 2021 22:35:35 +0000 (14:35 -0800)]
generic: add helpers for dumping fs-verity metadata

In common/verity, add helper functions for dumping a file's fs-verity
metadata using the new FS_IOC_READ_VERITY_METADATA ioctl.

Signed-off-by: Eric Biggers <ebiggers@google.com>
8 months agogeneric: factor out helpers for fs-verity built-in signatures
Eric Biggers [Wed, 24 Feb 2021 22:35:34 +0000 (14:35 -0800)]
generic: factor out helpers for fs-verity built-in signatures

The test for retrieving a verity file's built-in signature using
FS_IOC_READ_VERITY_METADATA will need to set up a file with a built-in
signature, which requires the same commands that generic/577 does.
Factor this out into helper functions in common/verity.

Signed-off-by: Eric Biggers <ebiggers@google.com>
8 months agogeneric/60[78]: ensure the initial DAX file flag state before test
Darrick J. Wong [Tue, 2 Mar 2021 23:22:56 +0000 (15:22 -0800)]
generic/60[78]: ensure the initial DAX file flag state before test

Since this test checks the behaviors of both the in-core S_DAX flag and
the ondisk FS_XFLAG_DAX inode flags, it must be careful about the
initial state of the filesystem w.r.t. the inode flag.

Make sure that the root directory does /not/ have the inode flag set
before we begin testing, so that the initial state doesn't throw off
inheritance testing.

[Eryu: change chattr command to xfs_io -c 'chattr']

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
8 months agocommon/rc: fix detection of device-mapper/persistent memory incompatibility
Darrick J. Wong [Tue, 2 Mar 2021 23:22:50 +0000 (15:22 -0800)]
common/rc: fix detection of device-mapper/persistent memory incompatibility

In commit fc7b3903, we tried to make _require_dm_target smart enough to
_notrun tests that require a device mapper target that isn't compatible
with "DAX".  However, as of this writing, the incompatibility stems from
device mapper's unwillingness to switch access modes when running atop
DAX (persistent memory) devices, and has nothing to do with the
filesystem mount options.

Since filesystems supporting DAX don't universally require "dax" in the
mount options to enable that functionality, switch the test to query
sysfs to see if the scratch device supports DAX.

Fixes: fc7b3903 ("dax/dm: disable testing on devices that don't support dax")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
8 months agoxfs/271: fix test failure on non-reflink filesystems
Darrick J. Wong [Tue, 2 Mar 2021 23:22:45 +0000 (15:22 -0800)]
xfs/271: fix test failure on non-reflink filesystems

This test creates an empty filesystem with rmap btrees enabled, and then
checks that GETFSMAP corresponds (roughly) with what we expect mkfs to
have written to the filesystem.

Unfortunately, the test's calculation for the number of "per-AG
metadata" extents is not quite correct.  For a filesystem with a
refcount btree, the rmapbt and agfl blocks will be reported separately,
but for non-reflink filesystems, GETFSMAP merges the records.

Since this test counts the number of records, fix the calculation.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
8 months agogeneric/623: don't fail on core dumps
Darrick J. Wong [Tue, 2 Mar 2021 23:22:39 +0000 (15:22 -0800)]
generic/623: don't fail on core dumps

This test is designed to fail an mmap write and see what happens.
Typically this is a segmentation fault.  If the user's computer is
configured to capture core dumps, this will cause the test to fail, even
though we got the reaction we wanted.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
8 months agofstests: remove _require_no_rtinherit completely
Zorro Lang [Mon, 1 Mar 2021 01:46:03 +0000 (09:46 +0800)]
fstests: remove _require_no_rtinherit completely

The _require_no_rtinherit has been removed by:
  0ac0d8fb ("common: remove _require_no_rtinherit")

But some cases still remain the _require_no_rtinherit, so remove
them all.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
8 months agocheck: add CLI option to repeat and stop tests in case of failure
Ritesh Harjani [Thu, 11 Feb 2021 03:31:44 +0000 (09:01 +0530)]
check: add CLI option to repeat and stop tests in case of failure

Currently with -i <n> option the test can run for many iterations,
but in case if we want to stop the iteration in case of a failure,
it is much easier to have such an option which could check the
failed status and stop the test from further proceeding.

This patch adds such an option (-I <n>) thereby extending the -i <n>
option functionality.

Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
8 months agobtrfs: make sure we rescan all devices after unregistering
Qu Wenruo [Thu, 25 Feb 2021 05:57:17 +0000 (13:57 +0800)]
btrfs: make sure we rescan all devices after unregistering

There are some btrfs test cases utilizing
_btrfs_forget_or_module_reload() to unregister all btrfs devices.

However _btrfs_forget_or_module_reload() will unregister all devices,
meaning if TEST_DEV is part of a multi-device btrfs, after those test
cases TEST_DEV will no longer be mountable.

This patch will introduce a new function, btrfs_rescan_devices() to undo
the unregister, so that all later test cases can mount TEST_DEV without
any problem.

Since we are here, also add a missing
_require_btrfs_forget_or_module_loadable for btrfs/225.

Reported-by: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
8 months agobtrfs: clone a hole post eof when using NO_HOLES feature
Filipe Manana [Tue, 16 Feb 2021 11:10:15 +0000 (11:10 +0000)]
btrfs: clone a hole post eof when using NO_HOLES feature

Test that when using the NO_HOLES feature, if we truncate down a
file, clone a file range covering only a hole into an offset beyond
the current file size, and then fsync the file, after a power
failure we get the expected file content and we do not get stale
data corresponding to file extents that existed before truncating
the file.

This currently fails on btrfs and is fixed by commit 3660d0bcdb82
("btrfs: fix stale data exposure after cloning a hole with NO_HOLES
enabled")

[Eryu: add the commit id of the patch fixing the bug]

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
8 months agofuzzy: capture core dumps from repair utilities
Darrick J. Wong [Wed, 10 Feb 2021 02:56:53 +0000 (18:56 -0800)]
fuzzy: capture core dumps from repair utilities

Always capture the core dumps when we run repair tools against a fuzzed
filesystem.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
8 months agocheck: run tests in exactly the order specified
Darrick J. Wong [Wed, 10 Feb 2021 02:56:47 +0000 (18:56 -0800)]
check: run tests in exactly the order specified

Introduce a new --exact-order switch to disable all sorting, filtering
of repeated lines, and shuffling of test order.  The goal of this is to
be able to run tests in a specific order, namely to try to reproduce
test failures that could be the result of a -r(andomize) run getting
lucky.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
8 months agocheck: don't abort on non-existent excluded groups
Darrick J. Wong [Wed, 10 Feb 2021 02:56:42 +0000 (18:56 -0800)]
check: don't abort on non-existent excluded groups

Don't abort the whole test run if we asked to exclude groups that aren't
included in the candidate group list, since we actually /are/ satisfying
the user's request.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
8 months agocheck: allow '-e testid' to exclude a single test
Darrick J. Wong [Wed, 10 Feb 2021 02:56:36 +0000 (18:56 -0800)]
check: allow '-e testid' to exclude a single test

This enables us to mask off specific tests.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
8 months agoconfig: wrap xfs_metadump as $XFS_METADUMP_PROG like the other tools
Darrick J. Wong [Wed, 10 Feb 2021 02:56:25 +0000 (18:56 -0800)]
config: wrap xfs_metadump as $XFS_METADUMP_PROG like the other tools

When we set up a fstests run, preserve the path xfs_metadump binary with
an $XFS_METADUMP_PROG wrapper, like we do for the other xfsprogs tools.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
9 months agogeneric: test mapped write after shutdown and failed writeback
Brian Foster [Wed, 10 Feb 2021 17:06:28 +0000 (12:06 -0500)]
generic: test mapped write after shutdown and failed writeback

XFS has a regression where it failed to check shutdown status in the
write fault path. This produced an iomap warning if the page
happened to recently fail a writeback attempt because writeback
failure can clear Uptodate status on the page.

Add a test for this scenario to help ensure mapped write failures
are handled as expected in the event of filesystem shutdown.
Upstream commit e4826691cc7e ("xfs: restore shutdown check in mapped
write fault path") fixed this bug.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
9 months agooverlay: Regression test for deadlock on directory ioctl
Amir Goldstein [Wed, 10 Feb 2021 19:03:34 +0000 (21:03 +0200)]
overlay: Regression test for deadlock on directory ioctl

Overlayfs added the ability to set inode flags (e.g. chattr +i) in
kernel 5.10 by commit 61536bed2149 ("ovl: support [S|G]ETFLAGS and
FS[S|G]ETXATTR ioctls for directories").
Icenowy Zheng reported [1] a regression in that commit that causes
a deadlock when setting inode flags on lower dir.

The regression was fixed by commit b854cc659dcb ("ovl: avoid deadlock
on directory ioctl") and applied to kernel 5.10.15.

[1] https://lore.kernel.org/linux-unionfs/20210101201230.768653-1-icenowy@aosc.io/

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
9 months agooverlay: Test lost immutable/append-only flags on copy-up
Amir Goldstein [Wed, 10 Feb 2021 19:03:33 +0000 (21:03 +0200)]
overlay: Test lost immutable/append-only flags on copy-up

Chengguang Xu reported [1] that append-only flag is lost on copy-up.
I had noticed that for directories, immutable flag can also be lost
on copy up (when parent is copied up). That's an old overlayfs bug.

Fixing this requires some VFS API changes that Miklos has proposed[2]

[1] https://lore.kernel.org/linux-unionfs/20201226104618.239739-1-cgxu519@mykernel.net/
[2] https: //lore.kernel.org/linux-fsdevel/20210203124112.1182614-1-mszeredi@redhat.com/

[Eryu: referencing the thread of the pending fix]

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
9 months agosrc/t_immutable: Allow setting flags on existing files
Amir Goldstein [Wed, 10 Feb 2021 19:03:32 +0000 (21:03 +0200)]
src/t_immutable: Allow setting flags on existing files

For overlayfs tests we need to be able to setflags on existing
(lower) files.

t_immutable -C test_dir

Creates the test area and sets flags, but it also allows setting flags
on an existing test area.

t_immutable -R test_dir

Removes the flags from existing test area, but does not remove the files
in the test area.

To setup a test area with file without flags, need to run the -C and -R
commands.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
9 months agosrc/t_immutable: factor out some helpers
Amir Goldstein [Wed, 10 Feb 2021 19:03:31 +0000 (21:03 +0200)]
src/t_immutable: factor out some helpers

Reduce boilerplate code.
define _GNU_SOURCE needed for asprintf.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
9 months agooverlay/030: Update comment w.r.t upstream kernel
Amir Goldstein [Wed, 10 Feb 2021 19:03:30 +0000 (21:03 +0200)]
overlay/030: Update comment w.r.t upstream kernel

commit 61536bed2149 ("ovl: support [S|G]ETFLAGS and FS[S|G]ETXATTR
ioctls for directories") makes the comment in test header inaccurate.
Fix the comment to include this information.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
9 months agocommon: remove _require_no_rtinherit
Darrick J. Wong [Wed, 10 Feb 2021 02:57:06 +0000 (18:57 -0800)]
common: remove _require_no_rtinherit

All the remaining tests that use _require_no_rtinherit can be adapted to
ignore SCRATCH_RTDEV or to force files to be created on the data device.
This makes the helper unnecessary and increases test coverage, so remove
this helper.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
9 months agoxfs: fix filestreams tests when rtinherit=1
Darrick J. Wong [Wed, 10 Feb 2021 02:57:00 +0000 (18:57 -0800)]
xfs: fix filestreams tests when rtinherit=1

The filestreams allocator can only be selected for files that reside on
the data volume.  In commit ee3e0010, we sprinkled calls to
_require_no_rtinherit in the filestreams tests so that there wouldn't be
regressions reported if the filesystem is formatted with -d rtinherit=1.

This unnecessarily limits test coverage because userspace can control
the device selection parameters quite easily with xfs_io chattr.  Make
the filestreams tests unset SCRATCH_RTDEV so that the allocator isn't
thrown off by the rtbitmap consuming space on the data device.

Fixes: ee3e0010 ("xfs/realtime: add _require_no_rtinherit function")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
9 months agosrc/splice-test.c: use memalign instead of aligned_alloc
David Sterba [Tue, 9 Feb 2021 15:57:15 +0000 (16:57 +0100)]
src/splice-test.c: use memalign instead of aligned_alloc

The build fails on SLE11 as the function aligned_alloc is not
available there. Replace it by memalign that has the same semantics
and is commonly used in fstests code base. aligned_alloc has
additional requirements on the alignment and buffer size but that is
ok as the buffer is defined in multiples of the alignment.

Signed-off-by: David Sterba <dsterba@suse.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
9 months ago_scratch_mkfs_geom(): Filter out 'k' suffix from fs block size
Chandan Babu R [Tue, 9 Feb 2021 16:12:52 +0000 (21:42 +0530)]
_scratch_mkfs_geom(): Filter out 'k' suffix from fs block size

If the original value of $MKFS_OPTIONS contained a block size value
having 'k' as a suffix (e.g. -b size=4k), then the newly constructed
value of $MKFS_OPTIONS will have 'k' suffixed to the value of
$blocksize.  $blocksize itself is specified in units of bytes. Hence
having 'k' suffixed to this value will result in an incorrect block
size.

This commit fixes the bug by conditionally filtering out the 'k'
suffix from block size option present in the original value of
$MKFS_OPTIONS.

Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
9 months agoxfs: test a regression in dquot type checking
Darrick J. Wong [Tue, 2 Feb 2021 19:41:58 +0000 (11:41 -0800)]
xfs: test a regression in dquot type checking

This is a regression test for incorrect ondisk dquot type checking that
was introduced in Linux 5.9.  The bug is that we can no longer switch a
V4 filesystem from having group quotas to having project quotas (or vice
versa) without logging corruption errors.  That is a valid use case, so
add a regression test to ensure this can be done.

[Eryu: add _require_check_dmesg and print the 'corruption' dmesg]

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
9 months agosrc/swapon.c: initiate p to NULL
Sun Ke [Mon, 1 Feb 2021 07:57:05 +0000 (15:57 +0800)]
src/swapon.c: initiate p to NULL

when run make, show:
swapon.c:135:3: warning: 'p' may be used uninitialized in this function
[-Wmaybe-uninitialized]
   memcpy(p, buf, BUF_SIZE);
      ^~~~~~~~~~~~~~~~~~~~~~~~

This's a fake uninitialized warning.
gcc think the 'p' can be used uninitialized at here when verb is
TEST_MWRITE_BEFORE_AND_MWRITE_AFTER:
    case TEST_MWRITE_BEFORE_AND_MWRITE_AFTER:
memcpy(p, buf, BUF_SIZE);
break;

But, if verb is TEST_MWRITE_BEFORE_AND_MWRITE_AFTER, the 'p' will be
initialized by:
    switch (verb) {
    case TEST_MWRITE_BEFORE_AND_MWRITE_AFTER:
    case TEST_MWRITE_BEFORE:
p = mmap(NULL, BUF_SIZE, PROT_WRITE | PROT_READ, MAP_SHARED,

Silent the warning by initializing p to NULL anyway.

Signed-off-by: Sun Ke <sunke32@huawei.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
9 months agogeneric/095: don't silence fio error output
Zorro Lang [Tue, 2 Feb 2021 06:22:53 +0000 (14:22 +0800)]
generic/095: don't silence fio error output

This case print both fio stdout and stderr to .full file, that cause
we miss some unexpected failures when there's a bug. For example:

  file:io_u.c:1803, func=io_u error, error=Block device required

This's an regression issue we find on a downstream kernel, not in
upstream. So release unexpected fio error output to find more issues.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
9 months agoltp/fsstress: don't fail on io_uring ENOSYS
Eric Sandeen [Thu, 28 Jan 2021 21:31:40 +0000 (15:31 -0600)]
ltp/fsstress: don't fail on io_uring ENOSYS

We might have URING #defined at build time, but be running on a kernel
which does not support it.

For that reason, we should not exit with an error if
io_uring_queue_init() fails with ENOSYS. We can just note the lack of
support and skip all future io_uring operations.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
10 months agogeneric: test for lazytime timestamp updates
Eric Biggers [Fri, 22 Jan 2021 01:44:34 +0000 (17:44 -0800)]
generic: test for lazytime timestamp updates

Test that when the lazytime mount option is enabled, updates to atime,
mtime, and ctime get persisted in the cases when they should be.

This test currently runs on ext4, f2fs, and xfs, since it's limited to
filesystems that support the shutdown ioctl.

This test currently passes on ext4 and f2fs.  On xfs, kernel
commit 1e249cb5b7fc ("fs: fix lazytime expiration handling in
__writeback_single_inode()") is needed for the test to pass, since xfs
had a bug where it didn't persist timestamps when it should have.

[Eryu: add shutdown metadata atime group]

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
10 months agoext4/046: skip test when ext4 doesn't support bs < ps with dioread_nolock
Yang Xu [Tue, 19 Jan 2021 06:13:39 +0000 (14:13 +0800)]
ext4/046: skip test when ext4 doesn't support bs < ps with dioread_nolock

When testing arm machine, this case fails because ps > bs and kernel
doesn't introduced commit c8cc88163f40 ("ext4: Add support for
blocksize < pagesize in dioread_nolock").  Only skip this case when
kernel complains about bs!=ps error, so we can find dioread_nolock
mount regression in the future.

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>
10 months agoxfs: test mkfs.xfs config files
Darrick J. Wong [Tue, 27 Oct 2020 20:54:50 +0000 (07:54 +1100)]
xfs: test mkfs.xfs config files

Simple tests of the upcoming mkfs.xfs config file feature.  First we
have some simple tests of properly formatted config files, then
improperly formatted config files, and finally we try to spot
conflicts between config file options and the cli.

[dchinner: updated for new libinih-based implementation.]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
10 months agobtrfs: check qgroup doesn't crash when beyond limit
Qu Wenruo [Tue, 12 Jan 2021 07:40:24 +0000 (15:40 +0800)]
btrfs: check qgroup doesn't crash when beyond limit

There is a bug that, when btrfs is beyond qgroup limit, touching a file
could crash btrfs.

Such beyond limit situation needs to be intentionally created, e.g.
writing 1GiB file, then limit the subvolume to 512 MiB.
As current qgroup works pretty well at preventing us from reaching the
limit.

This makes existing qgroup test cases unable to detect it.

The regression is introduced by commit c53e9653605d ("btrfs: qgroup:
try to flush qgroup space when we get -EDQUOT"), and the fix is
commit 6f23277a49e6 ("btrfs: qgroup: don't commit transaction when
we already hold the handle")

Link: https://bugzilla.suse.com/show_bug.cgi?id=1178634
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
10 months agocommon/filter: add _filter_stat
Murphy Zhou [Tue, 12 Jan 2021 05:31:16 +0000 (13:31 +0800)]
common/filter: add _filter_stat

Since coreutils upstream v8.32~47

  commit a99ab266110795ed94a9cb4d2765ddad9c4310da
  Author: Jeff Layton <jlayton@kernel.org>
  Date:   Thu Sep 19 11:59:45 2019 -0400

      ls: use statx instead of stat when available

stat(1) starts to use statx(2) call.

In some testcase, if file does not exist, this breaks golden
output like this:

-stat: cannot stat 'SCRATCH_MNT/xxx': No such file or directory
+stat: cannot statx 'SCRATCH_MNT/xxx': No such file or directory

Add this filter to fix it, and add this filter to testcases that
need it.

Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
10 months agobtrfs: test incremental send after cloning extents from the same file
Filipe Manana [Mon, 11 Jan 2021 11:41:54 +0000 (11:41 +0000)]
btrfs: test incremental send after cloning extents from the same file

Test that an incremental send operation correctly issues clone operations
for a file that had different parts of one of its extents cloned into
itself, at different offsets, and a large part of that extent was
overwritten, so all the reflinks only point to subranges of the extent.

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

 "btrfs: send, fix invalid clone operations when cloning from the same file and root"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
10 months agobtrfs: test correct operation of free objectid related functionality
Nikolay Borisov [Mon, 11 Jan 2021 09:17:42 +0000 (11:17 +0200)]
btrfs: test correct operation of free objectid related functionality

This test verifies btrfs' free objectid management. I.e it ensures that
the first objectid is always 256 in an fs tree.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
10 months agogeneric/496: ext4 and xfs supports swapon on fallocated file
Ritesh Harjani [Tue, 5 Jan 2021 14:31:43 +0000 (20:01 +0530)]
generic/496: ext4 and xfs supports swapon on fallocated file

ext4, xfs should not fail swapon on fallocated file. Currently if this
fails the fstst was not returning a failure. Fix those for given
filesystems (for now added ext4/xfs).
There were some regressions which went unnoticed due to this in ext4
tree, which later got fixed as part of this patch [1]

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

Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
10 months agocommon/rc: swapon should not fail for given FS in _require_scratch_swapfile()
Ritesh Harjani [Tue, 5 Jan 2021 14:31:42 +0000 (20:01 +0530)]
common/rc: swapon should not fail for given FS in _require_scratch_swapfile()

Filesystems e.g. ext* and XFS supports swapon by default and an error
returned with swapon should be treated as a failure.

Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
10 months agogeneric/388: randomly recover via read-only mounts
Brian Foster [Tue, 5 Jan 2021 11:58:44 +0000 (06:58 -0500)]
generic/388: randomly recover via read-only mounts

XFS has an issue where superblock counters may not be properly
synced when recovery occurs via a read-only mount. This causes the
filesystem to become inconsistent after unmount. To cover this test
case, update generic/388 to switch between read-only and read-write
mounts to perform log recovery.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>