Darrick J. Wong [Mon, 21 Jun 2021 15:55:09 +0000 (08:55 -0700)]
fstests: move test group info to test files
Refactor every test in the entire test suite to use the new boilerplate
functions. This also migrates all the test group information into the
test files. This patch has been autogenerated via the command:
Darrick J. Wong [Mon, 21 Jun 2021 15:54:54 +0000 (08:54 -0700)]
fstests: add tool migrate group membership data to test files
Create a tool to migrate the mapping of tests <-> groups out of the
group file and into the individual test file as a _begin_fstest
call. In the next patches we'll rewrite all the test files and auto
generate the group files from the tests.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Mon, 21 Jun 2021 15:54:54 +0000 (08:54 -0700)]
fstests: refactor test boilerplate code
Create two new helper functions to deal with boilerplate test code:
A helper function to set the seq and seqnum variables. We will expand
on this in the next patch so that fstests can autogenerate group files
from now on.
A helper function to register cleanup code that will run if the test
exits or trips over a standard range of signals.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Mon, 21 Jun 2021 15:54:53 +0000 (08:54 -0700)]
misc: move exit status into trap handler
Move the "exit $status" clause of the _cleanup function into the
argument to the "trap" command so that we can standardize the
registration of the atexit cleanup code in the next few patches.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Mon, 21 Jun 2021 15:54:53 +0000 (08:54 -0700)]
fstests: fix group check in new script
In the tests/*/group files, group names are found in the Nth columns of
the file, where N > 1. The grep expression to warn about unknown groups
is not correct (since it currently checks column 1), so fix this.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Filipe Manana [Wed, 9 Jun 2021 10:25:14 +0000 (11:25 +0100)]
btrfs: test incremental send swapping location of a directory with a file
Test that an incremental send operation succeeds, and produces the
correct results, after renaming and moving around directories and files
with multiple hardlinks, in such a way that one of the files gets the old
name and location of a directory and another name (hardlink) with the old
name and location of another file that was located in that same directory.
This currently fails on btrfs but is fixed by a kernel patch with the
following subject:
"btrfs: send: fix invalid path for unlink operations after parent orphanization"
Leah Rumancik [Mon, 7 Jun 2021 21:55:09 +0000 (21:55 +0000)]
ext4: test journal checkpoint ioctl
Test for commit "ext4: add ioctl EXT4_IOC_CHECKPOINT". Tests journal
checkpointing and journal erasing via EXT4_IOC_CHECKPOINT with flag
EXT4_IOC_CHECKPOINT_FLAG_ZEROOUT set.
Leah Rumancik [Mon, 7 Jun 2021 21:36:38 +0000 (21:36 +0000)]
ext4/048: add check for od endian flag
od --endian=little is used to read bytes in little endian when on a
big endian machine. Update test ext4/048 to require od endian flag
support on big endian machines, otherwise, skip test.
Anand Jain [Mon, 7 Jun 2021 12:08:19 +0000 (20:08 +0800)]
btrfs: support other sectorsizes in _scratch_mkfs_blocksized
When btrfs supports sectorsize != pagesize it can run these test cases
now,
generic/205 generic/206 generic/216 generic/217 generic/218 generic/220
generic/222 generic/227 generic/229 generic/238
This change is backward compatible for kernels without non pagesize
sectorsize support.
Amir Goldstein [Sun, 6 Jun 2021 15:18:11 +0000 (18:18 +0300)]
overlay/075: add test coverage for clearing immutable/append-only flags
overlay/075 is a variant of check -overlay generic/079.
check -overlay generic/079 does the following operations on overlay fs:
1. Create files
2. Set immutable/append-only flags
3. Verify files/dirs behaving as immutable/append-only
4. Clear immutable/append-only flags
5. Remove files
overlay/075 performs steps 1,2,4,5 on upper and lower layers
and only step 3 is performed on overlay fs (before and after copy up
and mount cycle).
Add also steps 4,5 to be performed on overlay fs to increase the
test coverage of the "merged" inode xflags feature.
Amir Goldstein [Fri, 11 Jun 2021 13:10:29 +0000 (16:10 +0300)]
generic/507: support more filesystems
The commit message introducing the test says:
"We only check below attribute modification which most filesystem
supports:
- no atime updates (A)
- secure deletion (s)
- synchronous updates (S)
- undeletable (u)
"
But in fact, very few filesystems support the (s) and (u) flags.
xfs and btrfs do not support them for example.
The test doesn't need to check those specific flags, so replace those
flags with immutable (i) and append-only (a), which most filesystems
really do support.
Zorro Lang [Tue, 25 May 2021 04:46:41 +0000 (12:46 +0800)]
common/config: remove default 4k blocksize from XFS_MKFS_OPTIONS
xfstests set "-bsize=4k" to XFS_MKFS_OPTIONS by default, then give
it to MKFS_OPTIOPNS. So MKFS_OPTIOPNS always contains "-bsize=4k"
except we set XFS_MKFS_OPTIONS manually.
It's useless to set XFS_MKFS_OPTIONS to "-bsize=4096" by default,
especially that will cause all cases with _scratch_mkfs_blocksized()
always fail as "-b size option respecified", when test on XFS. For
exmaple: generic/222
Signed-off-by: Zorro Lang <zlang@redhat.com> Acked-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Amir Goldstein [Sat, 5 Jun 2021 09:43:26 +0000 (12:43 +0300)]
overlay/075: fix wrong invocation of t_immutable
t_immutable cannot be run twice on the same test directoty, because
append-only directory tests create files in append-only.d and those
file already exist from the first run.
Use separate test directories for the first and second t_immutable runs.
Anand Jain [Fri, 4 Jun 2021 06:25:47 +0000 (14:25 +0800)]
btrfs/029: fix the test compatible with older cp(1)
cp(1) versions 8.30 and 8.32 are compared with its --reflink=always option
and they have different semantic if the target-file (with zero sizes) must be
created when the cp --reflink=alaways fails with a cross-device link
error. As shown below.
$ cp --version | head -1
cp (GNU coreutils) 8.30
$ cp --reflink=always /mnt/scratch/original /mnt/test/test-029/copy
cp: failed to clone '/mnt/test/test-029/copy' from '/mnt/scratch/original': Invalid cross-device link
$ ls -l /mnt/test/test-029/copy
ls: cannot access '/mnt/test/test-029/copy': No such file or directory
$ cp --version | head -1
cp (GNU coreutils) 8.32
$ cp --reflink=always /mnt/scratch/original /mnt/test/test-029/copy;
cp: failed to clone '/mnt/test/test-029/copy' from '/mnt/scratch/original': Invalid cross-device link
$ ls -l /mnt/test/test-029/copy
-rw------- 1 root root 0 Jun 4 13:29 /mnt/test/test-029/copy
chenlong [Fri, 28 May 2021 03:13:07 +0000 (11:13 +0800)]
ext4: prevent initializing reserved inodes
Check the block group zero and prevent initializing reserved inodes.
But in some special cases, the reserved inode may not all belong to
the group zero, it may exist into the second group if we formatĀ
filesystem below.
Kent Overstreet [Tue, 25 May 2021 22:19:53 +0000 (18:19 -0400)]
fstests: initial bcachefs support
To get started, you'll need to get bcachefs from the kernel repository
https://evilpiepirate.org/git/bcachefs.git/
and tools from
https://evilpiepirate.org/git/bcache-tools.git/
Build kernel as normal, enabling CONFIG_BCACHEFS_FS (and probably
CONFIG_BCACHEFS_DEBUG), and build and install tools. Then running
fstests is exactly the same as other local filesystems - just set
FSTYP=bcachefs
Also see https://evilpiepirate.org/git/ktest.git/ for a tool for
conveniently building kernel and running fstests inside a qemu VM.
This patch also updates generic/441 to run the more thorough test on
bcachefs, and generic/425 to not run on bcachefs (since bcachefs does
not store xattrs in blocks)
Sun Ke [Tue, 18 May 2021 11:47:00 +0000 (07:47 -0400)]
generic/042: set size to 38M for f2fs
25M is too small for f2fs:
Info: Disable heap-based policy
Info: Debug level = 0
Info: Label =
Info: Trim is enabled
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 51200 (25 MB)
Info: zone aligned segment0 blkaddr: 512
Error: Device size is not sufficient for F2FS volume
Error: Failed to prepare a super block!!!
Error: Could not format the device!!!
So, set size to 38M for f2fs.
Signed-off-by: Sun Ke <sunke32@huawei.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Filipe Manana [Mon, 24 May 2021 10:37:21 +0000 (11:37 +0100)]
btrfs: add test for multiple fsync with adjacent preallocated extents
Test a scenario where we do several partial writes into multiple
preallocated extents across two transactions and with several fsyncs
in between. The goal is to check that the fsyncs succeed.
Currently the last fsync fails with an -EIO error, and it aborts the
current transaction. This issue is fixed by a patch with the following
subject:
"btrfs: fix fsync failure and transaction abort after writes to prealloc extents"
Yang Xu [Fri, 28 May 2021 09:41:10 +0000 (17:41 +0800)]
common/xfs: Fix _require_scratch_xfs_shrink bug
Since local declaration can't pass function return value, this
helper never detects whether kernel or xfsprogs supports xfs shrink
feature successfully. Fit it by separating declaration and
assignment of local variables.
Zorro Lang [Fri, 21 May 2021 08:01:45 +0000 (16:01 +0800)]
generic: mmap and copy file data with page overlapping
Mmap 2 pages of file, write 64 bytes to the first and second pages,
copy the data from the first page and then second page to the second
page offset with $pagesize - 64. Verify the data at the end.
Qu Wenruo [Mon, 17 May 2021 09:29:22 +0000 (17:29 +0800)]
btrfs/215: avoid false alert for subpage case
[BUG]
When running btrfs/215 with 64K page size, 4K sectorsize (subpage RW
support), it fails with the following error:
btrfs/215 [failed, exit status 1]- output mismatch (see ~/xfstests-dev/results//btrfs/215.out.bad)
--- tests/btrfs/215.out 2021-03-19 16:34:26.069634953 +0800
+++ ~/xfstests-dev/results//btrfs/215.out.bad 2021-05-17 16:52:34.743514224 +0800
@@ -1,2 +1,3 @@
QA output created by 215
-Silence is golden
+Errors: 8 expected: 2
+(see ~/xfstests-dev/results//btrfs/215.full for details)
...
(Run 'diff -u ~/xfstests-dev/tests/btrfs/215.out ~/xfstests-dev/results//btrfs/215.out.bad' to see the entire diff)
[CAUSE]
For subpage case, btrfs still tries to read the full page, other than
read just one sector for PAGE_SIZE == sectorsize case.
This means for the 2 sectors corrupted case, since they are in the same
page, all the errors will be reported.
[FIX]
Change the following values:
- filesize
Now it's 8 * pagesize.
- expected error number
Now it's 2 * sectors_per_page or 6 * sectors_per_page.
This program fails on filesystems where the stat() block size isn't a
strict power of two because it foolishly feeds that to posix_memalign to
allocate an aligned memory buffer for directio. posix_memalign requires
the alignment value to be a power of two, so generic/586 fails.
The system page size generally works well for directio buffers, so use
that instead.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 19 May 2021 23:57:10 +0000 (16:57 -0700)]
xfs/178: fix mkfs success test
Fix the obviously incorrect code here that wants to fail the test if
mkfs doesn't succeed. The return value ("$?") is always the status of
the /last/ command in the pipe.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 19 May 2021 23:57:04 +0000 (16:57 -0700)]
fsx/fsstress: round blocksize properly
The block sizes reported by stat and DIOINFO aren't required to be
powers of two. This can happen on an XFS filesystem with a realtime
extent size that isn't a power of two; on such filesystems, certain IO
calls will fail due to alignment issues. Fix that by providing rounding
helpers that work for all sizes.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 19 May 2021 23:56:58 +0000 (16:56 -0700)]
xfs/117: fix fragility in this fuzz test
This fuzz test has some fragility problems -- it doesn't do anything to
guarantee that the inodes that it checks for EFSCORRUPTED are the same
ones that it fuzzed, and it doesn't explicitly try to avoid victimizing
inodes in the same chunk as the root directory. As a result, this test
fails annoyingly frequently.
Fix both of these problems and get rid of the confusingly named TESTDIR
variable.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 19 May 2021 23:56:52 +0000 (16:56 -0700)]
xfs: force file creation to the data device for certain layout tests
I found a bunch more tests in the xfs/ directory that try to create
specific metadata layouts on the data device, either because they're
fuzz tests or because they're testing specific edge cases of the code
base. Either way, these test need to override '-d rtinherit' in the
MKFS_OPTIONS, so do that with _xfs_force_bdev.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 19 May 2021 23:56:46 +0000 (16:56 -0700)]
common/xfs: refactor commands to select a particular xfs backing device
Refactor all the places where we try to force new file data allocations
to a specific xfs backing device so that we don't end up open-coding the
same xfs_io command lines over and over.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Sidong Yang [Sun, 23 May 2021 05:08:59 +0000 (05:08 +0000)]
btrfs/012: check free size of scratch device before copying files
This test failed when scratch device don't have enough space for
copying files. This patch gets size of files by du command and
checks if there is enough space in the device.
Jinhui Huang [Mon, 17 May 2021 03:34:13 +0000 (11:34 +0800)]
xfs: Add the appropriate _require helper
1.xfs/162 uses xfs_db -c 'fuzz' but forgets to check if the feature
is supported. This will cause the case to fail on a system without
fuzz support. so we add _require to check if the fuzz is supported.
2.xfs/495 use _require_scratch_xfs_fuzz_fields to check the features
required by field fuzzing, but some of the features are not used in
this case like xfs_scrub, this will cause the case to skip on a system
without xfs_scrub support, even if the features being uesd are supported.
So we just need to use _require to check the features being used.
Signed-off-by: Jinhui Huang <huangjh.jy@cn.fujitsu.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Filipe Manana [Wed, 12 May 2021 15:27:35 +0000 (16:27 +0100)]
btrfs: test log replay after directory fsync and moving a child directory
Test a particular scenario where we fsync a directory, then move one of
its children directories into another directory and then finally sync the
log trees by fsyncing any other inode. We want to check that after a power
failure we are able to mount the filesystem and that the moved directory
exists only as a child of the directory we moved it into.
This currently fails on a 5.12 kernel (and 5.13-rc1) but is fixed by a
patch with the following subject:
"btrfs: fix removed dentries still existing after log is synced"
The failure is due to ending up with a directory that has 2 hard links
(two parent directories) as soon as the log replay procedure finishes,
which causes the tree checker to detect the issue and cause the mount
operation to fail with -EIO.
Darrick J. Wong [Wed, 12 May 2021 02:02:19 +0000 (19:02 -0700)]
fsx: fix backwards parameters in complaint about overly long copy
If fsx encounters a situation where copy_file_range reports that it
copied more than it was asked to, we report this as a failure.
Unfortunately, the parameters to the print function are backwards,
leading to this bogus complaint about a short copy:
do_copy_range: asked 28672, copied 24576??
When we really asked to copy 24k but 28k was copied instead.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 12 May 2021 02:02:08 +0000 (19:02 -0700)]
common: always pass -f to $DUMP_COMPRESSOR
If the test runner gave us the name of a program to use to compress
dumps, always pass -f to overwrite older compressed images, like the
documentation says we do. This prevents the test suite from stalling on
"foo.md.gz exists, overwrite?" prompts.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 12 May 2021 02:01:56 +0000 (19:01 -0700)]
xfs: fix old fuzz test invocations of xfs_repair
Some of the older blocktrash-based fuzz tests cause the fs to go down
due to the corrupted image and fail to remount. Offline repair fails
because _repair_scratch_fs is the helper that is smart enough to call
xfs_repair -L, not _scratch_xfs_repair. Fix these instances.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
btrfs/187 436s ... - output mismatch (see /xfstests/results//btrfs/187.out.bad)
--- tests/btrfs/187.out 2020-10-16 23:13:46.550152492 +0100
+++ /xfstests/results//btrfs/187.out.bad 2021-04-27 14:57:02.623941700 +0100
@@ -1,3 +1,4 @@
QA output created by 187
Create a readonly snapshot of 'SCRATCH_MNT' in 'SCRATCH_MNT/snap1'
Create a readonly snapshot of 'SCRATCH_MNT' in 'SCRATCH_MNT/snap2'
+/xfstests/tests/btrfs/187: line 1: warning: wait_for: recursively setting old_sigint_handler to wait_sigint_handler: running_trap = 16
...
(Run 'diff -u /xfstests/tests/btrfs/187.out /xfstests/results//btrfs/187.out.bad' to see the entire diff)
Ran: btrfs/187
Failures: btrfs/187
Failed 1 of 1 tests
This is because the process running dedupe_files_loop() executes the 'wait'
command in the trap it has setup and very often it receives the SIGTERM
signal while it is running the 'wait' command in the while loop of that
function - so executing the trap makes bash run 'wait' while it is already
running 'wait', triggering the warning message from bash.
That warning message was added in bash 5.0 by commit 36f89ff1d8b761
("SIGINT trap handler SIGINT loop fix"):
Anand Jain [Mon, 3 May 2021 11:08:00 +0000 (19:08 +0800)]
btrfs: add fstrim test case on the sprout device
Add fstrim test case on the sprout device, verify seed device
integrity. Targeting kernel commit 5e753a817b2d ("btrfs: fix
unmountable seed device after fstrim")
Darrick J. Wong [Thu, 29 Apr 2021 01:31:54 +0000 (18:31 -0700)]
xfs/49[12]: skip pre-lazysbcount filesystems
Prior to lazysbcount, the xfs mount code blindly trusted the value of
the fdblocks counter in the primary super, which means that the kernel
doesn't detect the fuzzed fdblocks value at all. V4 is deprecated and
pre-lazysbcount V4 hasn't been the default for ~14 years, so we'll just
skip these two tests on those old filesystems.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 28 Apr 2021 04:09:18 +0000 (21:09 -0700)]
xfs/004: don't fail test due to realtime files
This test exercises xfs_db functionality that relates to the free space
btrees on the data device. Therefore, make sure that the files we
create are not realtime files.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 28 Apr 2021 04:09:12 +0000 (21:09 -0700)]
generic/449: always fill up the data device
This is yet another one of those tests that looks at what happens when
we run out of space for more metadata (in this case, xattrs). Make sure
that the 256M we write to the file to try to stimulate ENOSPC gets
written to the same place that xfs puts xattr data -- the data device.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 28 Apr 2021 04:09:00 +0000 (21:09 -0700)]
xfs/276: remove unnecessary mkfs golden output
A previous update to this test dropped the clause where the mkfs
standard output gets sent to /dev/null. The filtered mkfs output isn't
needed here and it breaks the test, so fix that.
Fixes: e97f96e5 ("xfs/27[26]: force realtime on or off as needed") Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Shreeya Patel [Mon, 3 May 2021 10:26:54 +0000 (15:56 +0530)]
generic/631: Add a check for extended attributes
Test case 631 fails for filesystems like exfat or vfat or any other
which does not support extended attributes.
The main reason for failure is not being able to mount overlayfs
with filesystems that do not support extended attributes.
mount -t overlay overlay -o "$l,$u,$w,$i" $mergedir
Above command would return an error as -
/var/mnt/scratch/merged0: wrong fs type, bad option, bad superblock
on overlay, missing codepage or helper program, or other error.
dmesg log reports the following -
overlayfs: filesystem on '/var/mnt/scratch/upperdir1' not supported
As per the overlayfs documentation -
"A wide range of filesystems supported by Linux can be the lower
filesystem, but not all filesystems that are mountable by Linux
have the features needed for OverlayFS to work. The lower filesystem
does not need to be writable. The lower filesystem can even be another
overlayfs. The upper filesystem will normally be writable and if it
is it must support the creation of trusted.* and/or user.* extended
attributes, and must provide valid d_type in readdir responses,
so NFS is not suitable. A read-only overlay of two read-only
filesystems may use any filesystem type."
As per the above statements from the overlayfs documentation,
it is clear that filesystems that do not support extended
attributes or d_type would not work with overlayfs.
This is why we see the error in dmesg log for upperdir1
which had an exfat filesystem.
This test case already checks for d_type but does not check for
extended attributes, hence add a check for it which would avoid
running this tests for filesystems that are not supported.
Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
DAX doesn't support swapfile. Without this patch,
_require_scratch_swapfile always returns fail for fsdax. Now
change to notrun.
Fixes: 725feeff ("common/rc: swapon should not fail for given FS in _require_scratch_swapfile()") Signed-off-by: Xiaoli Feng <xifeng@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 28 Apr 2021 04:09:47 +0000 (21:09 -0700)]
common/rc: relax xfs swapfile support checks
In commit 725feeff, I forgot that xfs has *not* always supported all
swap file configurations -- the bmap swapfile activation prior to the
introduction of iomap_swapfile_activate did not permit the use of
unwritten extents in the swap file. Therefore, kick xfs out of the
always-supported list.
Fixes: 725feeff ("common/rc: swapon should not fail for given FS in _require_scratch_swapfile()") Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Introduce some zone related helper functions: _zone_type(),
_require_zoned_device(), and _require_non_zoned_device(). They all
take a device path as an argument.
_zone_type() return the zone type of the device according to the
value returned from "/sys/block/<disk>/queue/zoned". See
Documentation/ABI/testing/sysfs-block for a detail.
_require_zoned_device() checks if the device is zoned. If not, it
skips the current test. _require_non_zoned_device() does the
opposite.
When this case runs on system without mount_setattr syscall support, it
will report errors rather than skip. so we add _require_idmapped_mounts
to check if mount_setattr syscall is supported.
Signed-off-by: Jinhui Huang <huangjh.jy@cn.fujitsu.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Filipe Manana [Tue, 27 Apr 2021 10:29:50 +0000 (11:29 +0100)]
btrfs: test fsync after rename and link with cow and nocow writes
Test for fsync data loss after renaming a file or adding a hard link,
with a previous fsync of another file, as well as that mtime and ctime
are correct after a power failure. Test both with COW and NOCOW writes.
This currently fails differently on different kernels:
- For kernels older than 4.19 (<= 4.18) and kernels starting from 5.10,
the NOCOW tests are expected to fail very often on the mtime and ctime
checks.
The data loss check has slim chances of failing on a virtualized
environment, because the race that leads to the data loss is due to
the fsync() returning after writeback of the data finishes and
returning without issuing barriers (sending REQ_PREFLUSH to the
device), as explained in the test's comments.
For kernels between 4.19 (inclusive) and 5.9 (inclusive), it is not
expected to fail.
- For the btrfs integration branch (misc-next), and what is currently in
Linus' master branch (5.13 merge window changes), in addition to the
failures mentioned before, the test should fail very often on the data
loss and mtime/ctime checks for COW writes.
The issues are fixed by a patch for the kernel that has the following
subject:
"btrfs: fix race leading to unpersisted data and metadata on fsync"
Amir Goldstein [Mon, 26 Apr 2021 16:01:43 +0000 (19:01 +0300)]
overlay/065: Adapt test to relaxed rules
Kernel commit 708fa01597fa ("ovl: allow upperdir inside lowerdir")
changes the rules w.r.t allowed overlayfs configurations, so the
upperdir/lowerdir test that expects an error fails.
Adapt the test to check the configuration that is still not allowed
(lowerdir inside upperdir), which had no test coverage.
generic/563: tolerate small reads in "write -> read/write" sub-test
On ext2/ext3, it's expected that several single block metadata reads
can occur when writing to file in the same cgroup (the stack is like
below[1]). The purpose of the "write -> read/write" subtest is to
make sure the larger pwrite is accounted to the correct cgroup, not
necessarily enforce that zero bytes are read in service of the
write. This patch fixes the sub-test in order to tolerate small
reads in 1st cgroup.
Yang Xu [Mon, 26 Apr 2021 07:57:03 +0000 (15:57 +0800)]
generic/631: remove useless nfs_export=off
The nfs_export feature was introduced since kernel v4.16-rc1 after
commit f168f1098dd9038 ("ovl: add support for "nfs_export"
configuration"). On old kernel, this case will result in infinite
loop because overlay mount failed because of unrecognized mount
options nfs_export=off.
In kernel documentation, overlay.rst said "the mount options
index=off,nfs_export=on are conflicting for a read-write mount and
will result in an error.". So using single index=off is also ok in
here.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Yang Xu [Mon, 26 Apr 2021 06:23:07 +0000 (14:23 +0800)]
src/idmapped-mounts: Remove useless header file
When compile xfstest on old kernel, mount-idmapped.c will fail
because of missing linux/bpf.h. But this src file doesn't use bpf
realted functions or macros.
So remove these useless header files in idmapped-mounts.c and
mount-idmapped.c.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Yang Xu [Sun, 25 Apr 2021 10:02:39 +0000 (18:02 +0800)]
src/idmapped-mounts: use renameat instead of renameat2
We don't add fallback for renameat2, so it build failed on old
kernel. Also, renameat2() man-pages said as below:
"renameat2() has an additional flags argument. A renameat2() call
with a zero flags argument is equivalent to renameat()."
In this src file, we use zero flag for all renameat2 call. So we use
renameat directly.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
Reviewed-by:Anju T Sudhakar<anju@linux.vnet.ibm.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Yang Xu [Sun, 25 Apr 2021 10:02:38 +0000 (18:02 +0800)]
src: Fix an error for the loop initialization declaration
When compile them old gcc, get the following error
mount-idmapped.c: In function 'parse_map':
mount-idmapped.c:154:2: error: 'for' loop initial declarations are only allowed in C99 mode
for (int i = 0; i < 2; i++) {
Fix them by declaring them at the beggining instead of in loop.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Yang Xu [Fri, 23 Apr 2021 04:23:58 +0000 (12:23 +0800)]
xfs/144: Use _qsetup instead of qsetup
Since xfstests commit 56908a2eb566c5("common/quota: move _qsetup()
helper to common code"), we have common _qsetup function. Even this
case doesn't use enforce value like xfs/050 and xfs/299, using
_qsetup is more meaningful. So remove useless qsetup.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Many test cases use xfs_io -c 'falloc' but forgot to add
_require_xfs_io_command "falloc". This will fail the test case if we
run the test case on a file system without fallcoate support e.g.
F2FS.
While we believe that normal fallocate(mode = 0) is always supported
on Linux, it is not true. Fallocate is disabled in several
implementations of zoned block support for file systems because the
pre-allocated region will break the sequential writing rule.
Currently, several test cases unconditionally call fallocate().
Let's add _require_xfs_io_command "falloc" to properly check the
feature is supported by a testing file system.
Darrick J. Wong [Wed, 21 Apr 2021 00:23:07 +0000 (17:23 -0700)]
generic: check userspace handling of extreme timestamps
These two tests ensure we can store and retrieve timestamps on the
extremes of the date ranges supported by userspace, and the common
places where overflows can happen.
They differ from generic/402 in that they don't constrain the dates
tested to the range that the filesystem claims to support; we attempt
various things that /userspace/ can parse, and then check that the vfs
clamps and persists the values correctly.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Thu, 22 Apr 2021 00:51:27 +0000 (17:51 -0700)]
xfs: functional testing of V5-relevant options
Currently, the only functional testing for xfs_admin is xfs/287, which
checks that one can add 32-bit project ids to a V4 filesystem. This
obviously isn't an exhaustive test of all the CLI arguments, and
historically there have been xfs configurations that don't even work.
Therefore, introduce a couple of new tests -- one that will test the
simple options with the default configuration, and a second test that
steps a bit outside of the test run configuration to make sure that we
do the right thing for external devices. The second test already caught
a nasty bug in xfsprogs 5.11.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 21 Apr 2021 00:22:31 +0000 (17:22 -0700)]
common/dmthin: make this work with external log devices
Provide a mkfs helper to format the dm thin device when external devices
are in use, and fix the dmthin mount helper to support them. This fixes
regressions in generic/347 and generic/500 when external logs are in
use.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 21 Apr 2021 00:22:25 +0000 (17:22 -0700)]
generic/223: make sure all files get created on the data device
This test formats filesystems with various stripe alignments, then
checks that data file allocations are actually aligned to those stripe
geometries. If this test is run on an XFS filesystem with a realtime
volume and RTINHERIT is set on the root dir, the test will fail because
all new files will be created as realtime files, and realtime
allocations are not subject to data device stripe alignments. Fix this
by clearing rtinherit on the root dir.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 14 Apr 2021 01:05:26 +0000 (18:05 -0700)]
xfs/305: make sure that fsstress is still running when we quotaoff
Greatly increase the number of fs ops that fsstress is supposed to run
in in this test so that we can ensure that it's still running when the
quotaoff gets run. 1000 might have been sufficient in 2013, but it
isn't now.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 14 Apr 2021 01:05:20 +0000 (18:05 -0700)]
generic/{094,225}: skip test when the xfs rt extent size is larger than 1 fsb
These two tests call various fallocate modes on a file and compare the
FIEMAP output to some golden output. Unfortunately, the golden output
doesn't take into account the possibility that (on XFS) the files could be
created on a realtime volume with a large rt extent size set.
Under such a configuration, fpunch operations that are aligned to the fs
block size but not the rt extent size simply result in those blocks
being set to unwritten status. Unfortunately, the test expects holes
and fails. Therefore, detect the situation and skip the tests.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 14 Apr 2021 01:05:14 +0000 (18:05 -0700)]
generic/620: fix order of require_scratch calls
_require_scratch_16T_support does not itself check that the scratch
device exists, which means that it depends on someone else to call
_require_scratch. Document this dependency and fix this test so that we
can run:
./check --exact-order generic/374 generic/620
on an ext4 filesystem without g/620 tripping over the mess left by g/374
when it calls _notrun.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 14 Apr 2021 01:05:07 +0000 (18:05 -0700)]
misc: replace more open-coded _scratch_xfs_db calls
Replace the last remaining open-coded calls to xfs_db for the scratch
device with calls to _scratch_xfs_db. This fixes these tests when
external logs are enabled.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 14 Apr 2021 01:04:54 +0000 (18:04 -0700)]
common/dump: filter out xfs_restore messages about fallocate failures
fallocate is not supported on XFS filesystems that are running in
"always COW" mode. This leads to false test regressions because
xfs_restore complains about EOPNOTSUPP in the golden output. The
preallocation isn't required for correct xfs_restore operation, so
filter out the EOPNOTSUPP messages.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 14 Apr 2021 01:04:42 +0000 (18:04 -0700)]
generic/563: selectively remove the io cgroup controller
If a system configuration tool such as systemd sets up the io cgroup
controller for its own purposes, it's possible that the last line of
this test will not be able to remove the io controller from the system
configuration. This causes the test to fail even though the inability
to tear down systemd should not be considered (in this case) a failure.
Change this test to set the "io" component of subtree control back to
whatever it was when the test started.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>