Darrick J. Wong [Thu, 15 Aug 2019 15:19:06 +0000 (08:19 -0700)]
generic/561: kill duperemove directly
While the kill statement added in the previous patch usually
suffices to shut down the bash loop that runs the duperemove
processes, for whatever reason this sometimes fails to kill
duperemove. Kill the duperemove processes directly after removing
the run file, which should cause the bash loop to exit immediately.
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>
Nikolay Borisov [Thu, 15 Aug 2019 10:22:40 +0000 (13:22 +0300)]
generic/519: Optimize overlap detection
Currently generic/519 takes around 5-10 minutes for me. This is
mainly due to the fact it uses a bunch of commands which spawn
processes. This, coupled by the fact the algorithm is O(n^2) in the
number of lines (624) for the sparse file and that test feels like
it's hung.
Fix this by re-implementing the existing logic in awk. This causes a
s single processes to be spawned and the rest of the processing is
done in-memory. This makes the test complete in 2 seconds for me.
Filipe Manana [Tue, 13 Aug 2019 16:22:55 +0000 (17:22 +0100)]
generic/517: make test work on filesystems with block size greater than 4Kb
The test currently fails on filesystems with a block size greater
than 4Kb, as dedupe operations fail with -EINVAL because the file
offsets used are not multiples of such block sizes (but they are
multiples of 4Kb, 2Kb and 1Kb).
So update the test to use offsets that are multiples of 64Kb, since
that allows the test to work on filesystems with any block size
between 4Kb and 64Kb (8Kb, 16Kb, 32Kb). Verified it works as
expected on kernels that have the fixes for the issue tested by this
test case (listed in the changelog of commit 91540ef980110f78161893f98d946e2afa0c1f4a), and on systems without
those fixes (a 4.18 kernel), it fails as it is supposed to.
Andreas Gruenbacher [Wed, 7 Aug 2019 11:25:14 +0000 (13:25 +0200)]
seek_sanity_test: Repair check for unwritten extent support
In test_basic_support, commit f3c1bca7fb25 ("generic: Test that
SEEK_HOLE can find a punched hole") cleverly punched a hole in the test
file in the middle of the check for unwritten extent support, making
sure we would never detect when unwritten extent support is missing.
Fix that.
While at it, explicitly check for SEEK_DATA support as well: so far, we
were assuming that SEEK_HOLE support implies SEEK_DATA support, but it
won't hurt to actually check.
Qu Wenruo [Thu, 8 Aug 2019 07:29:40 +0000 (15:29 +0800)]
log-writes: Handle unrecognized options to prevent segfault
[BUG]
When using --help parameter (unrecognized) after valid --log/--replay,
log-writes just crashes:
Starting program: replay-log --log /dev/test/test --replay /dev/test/scratch1 --help
/home/adam/xfstests-dev/src/log-writes/replay-log: unrecognized option '--help'
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f5cc55 in __strlen_avx2 () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007ffff7f5cc55 in __strlen_avx2 () from /usr/lib/libc.so.6
#1 0x00007ffff7e89363 in strdup () from /usr/lib/libc.so.6
#2 0x00005555555554ac in main (argc=6, argv=0x7fffffffea78)
at replay-log.c:219
[CAUSE]
We didn't check return value from getopt_long() for unrecognized
parameter, thus we reuse the old opt_index, and if that option needs an
parameter, we will access optarg which can be NULL and cause segfault.
[FIX]
Check return value from getopt_long() for '?' to handle unrecognized
options correctly.
Zorro Lang [Sun, 28 Jul 2019 09:07:15 +0000 (17:07 +0800)]
xfs: test statfs on project quota directory
There's a bug on xfs cause statfs get negative f_ffree value from
a project quota directory. It's fixed by "de7243057 fs/xfs: fix
f_ffree value for statfs when project quota is set". So add statfs
testing on project quota block and inode count limit.
Darrick J. Wong [Thu, 1 Aug 2019 01:43:04 +0000 (18:43 -0700)]
common/xfs: refactor agcount calculation for mounted filesystems
Create a helper function to return the number of AGs of a mounted
filesystem so that we can get rid of the open-coded versions in various
tests. The new helper will be used in a subsequent patch.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Thu, 1 Aug 2019 01:42:47 +0000 (18:42 -0700)]
xfs/122: mask wonky ioctls
Don't check the structure size of the inogrp/bstat/fsop_bulkreq
structures because they're incorrectly padded. When we remove the
old typdefs the old filter stops working.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Thu, 25 Jul 2019 18:04:13 +0000 (11:04 -0700)]
xfs/194: unmount forced v4 fs during cleanup
Unmount the V4 filesystem we forcibly created to run this test during
test cleanup so that the post-test wrapup checks won't try to remount
the filesystem with different MOUNT_OPTIONS (specifically, the ones
that get screened out by _force_xfsv4_mount_options) and fail.
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>
Darrick J. Wong [Wed, 24 Jul 2019 15:56:31 +0000 (08:56 -0700)]
xfs/033: filter out root inode nlink repair
A couple of releases ago, xfs_repair was patched to set the root inode
link count correctly when messing around with lost inodes. However, the
old xfs_repair remains in the golden output, so remove it and filter the
line so that we don't cause 'new' regressions on old software.
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>
Darrick J. Wong [Wed, 24 Jul 2019 15:55:43 +0000 (08:55 -0700)]
generic/506: mount scratch fs before testing for prjquota presence
On XFS, the _require_prjquota helper takes a path to a block device,
but (unintuitively) requires the block device to be mounted for the
detection to work properly. Fix the detection code in generic/506.
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>
Darrick J. Wong [Wed, 24 Jul 2019 04:13:06 +0000 (21:13 -0700)]
generic/561: kill duperemove after sleep_time
generic/561 can take a very long time to run on XFS (45+ minutes)
because it kicks off fsstress and a lot of duperemove processes,
waits 50 seconds, and then waits for the duperemove processes to
finish. duperemove, however, fights with fsstress for file locks
and can take a very long time to make even a single pass over the
filesystem and exit, which means the test just takes forever to run.
Once we've decided to tear down the duperemove processes let's just send
them SIGINT and then wait for them to exit.
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>
Amir Goldstein [Mon, 15 Jul 2019 12:55:15 +0000 (15:55 +0300)]
generic: copy_file_range bounds test
Test that copy_file_range will return the correct errors for various
error conditions and boundary constraints.
This is a regression test for kernel commit:
96e6e8f4a68d ("vfs: add missing checks to copy_file_range")
[Amir] Split out cross-device copy_range test and use only test dev.
Split out immutable/swapfile test cases to reduce the requirements to
run the bounds check to minimum and get coverage for more filesystems.
Remove the tests for read past EOF and write after chmod -r,
because we decided to stick with read(2)/write(2) semantics.
Add requirements needed for large size copy tests and fifo test.
Use existing char/block devices for char/block dev tests.
Signed-off-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Christoph Hellwig [Mon, 15 Jul 2019 08:25:22 +0000 (10:25 +0200)]
shared/011: run for all block device based file systems
Cgroupv2 writeback support can't be easily detected. But it is
kindof expected from block based file systems and can be easily
added, so just assume support and fail if it doesn't work.
Darrick J. Wong [Tue, 9 Jul 2019 17:49:53 +0000 (10:49 -0700)]
xfs/119: fix MKFS_OPTIONS exporting
This test originally exported its own MKFS_OPTIONS to force the tested
filesystem config to the mkfs defaults + test-specific log size options.
This overrides whatever the test runner might have set in MKFS_OPTIONS.
In commit 2fd273886b525 ("xfs: refactor minimum log size formatting
code") we fail to export our test-specific MKFS_OPTIONS before
calculating the minimum log size, which leads to the wrong min log size
being calculated once we fixed the helper to be smarter about mkfs options.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Allison Collins <allison.henderson@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Tue, 9 Jul 2019 17:49:47 +0000 (10:49 -0700)]
xfs/016: calculate minimum log size and end locations
xfs/016 looks for corruption in the log when the log wraps. However,
it hardcodes the minimum log size and the "95%" point where it wants to
start the "nudge and check for corruption" part of the test. New
features require larger logs, which causes the test to fail when it
can't mkfs with the smaller log size and when that 95% point doesn't put
us within 20x "_log_traffic 2"s of the end of the log.
Fix the first problem by using the new min log size helper and replace
the 95% figure with an estimate of where we need to be to guarantee that
the 20x loop wraps the log.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Allison Collins <allison.henderson@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Tue, 9 Jul 2019 17:49:41 +0000 (10:49 -0700)]
xfs: rework min log size helper
The recent _scratch_find_xfs_min_logblocks helper has a major thinko in
it -- it relies on feeding a too-small size to _scratch_do_mkfs so that
mkfs will tell us the minimum log size. Unfortunately, _scratch_do_mkfs
will see that first failure and retry the mkfs without MKFS_OPTIONS,
which means that we return the minimum log size for the default mkfs
settings without MKFS_OPTIONS.
This is a problem if someone's running fstests with a set of
MKFS_OPTIONS that affects the minimum log size. To fix this, open-code
the _scratch_do_mkfs retry behavior so that we only do the "retry
without MKFS_OPTIONS" behavior if the mkfs failed for a reason other
than the minimum log size check.
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>
Filipe Manana [Fri, 5 Jul 2019 11:26:21 +0000 (12:26 +0100)]
btrfs/189: make the test work on systems with a page size greater than 4Kb
The test currently uses offsets and lengths which are multiples of
4K, but not multiples of 64K (or any other page size between 4Kb and
64Kb). This makes the reflink calls fail with -EINVAL because
reflink only operates on ranges that are aligned to the the
filesystem's block size.
Fix this by ensuring all ranges passed to the reflink calls are
aligned to 64K, so that the test works on any system regardless of
its page size. The test still fails without the corresponding
kernel fix applied [1] as it is supposed to.
Eric Biggers [Mon, 8 Jul 2019 20:32:39 +0000 (13:32 -0700)]
generic/399: don't rely on xfs_io exit status
Unexpectedly, 'xfs_io -f $file -c "pwrite 0 1M"' exits with failure
status if the file can't be created, but exits with success status if an
error occurs actually writing data. As discussed previously, xfs_io's
exit status has always been broken, and it will be difficult to fix:
https://marc.info/?l=linux-xfs&m=151269053129101&w=2
Because of this, generic/399 fails on ext4 if "-I 256" (256-byte inodes)
is specified in the mkfs options, e.g. with 'kvm-xfstests -c ext4/adv
generic/399'. This is because the test tries to fill a filesystem
entirely with 1 MiB encrypted files, and it expects the xfs_io commands
to start failing when no more files should be able to fit. But when the
filesystem supports in-inode xattrs, no blocks need to be allocated for
the encryption xattrs, so empty encrypted files can continue to be
created even after all the filesystem's blocks are in-use.
For better or worse, the convention for xfstests is to ignore the exit
status of xfs_io and instead rely on the printed error messages. Thus,
other tests don't run into this problem. So for now, let's fix the test
failure by making generic/399 do the same.
The kernel version (uname -v) may also be needed in addition to
the kernel release (uname -r) in order to properly identify and
distinguish different kernel builds in some cases/distributions.
For example, in the Ubuntu kernel package the test/debug string
is usually a suffix to the version field, not the release field.
$ uname -rv
4.15.0-51-generic #55-Ubuntu SMP Wed May 15 14:27:21 UTC 2019
Looking at other OSes uname(1) man pages it looks like '-v' is
quite standard, and the Linux man page only cites '-p' and '-i'
as non-portable, so the change should be OK. The only caller is
the 'check' script for the header print out, so it's contained.
Filipe Manana [Fri, 28 Jun 2019 22:08:36 +0000 (23:08 +0100)]
generic: test cloning large exents to a file with many small extents
Test that if we clone a file with some large extents into a file
that has many small extents, when the fs is nearly full, the clone
operation does not fail and produces the correct result.
This is motivated by a bug found in btrfs wich is fixed by the
following patches for the linux kernel:
[PATCH 1/2] Btrfs: factor out extent dropping code from hole punch handler
[PATCH 2/2] Btrfs: fix ENOSPC errors, leading to transaction aborts, when
cloning extents
Theodore Ts'o [Fri, 28 Jun 2019 22:59:10 +0000 (18:59 -0400)]
shared,generic: move tests using duperemove to generic/
Add _require_scratch_duperemove which validates that the file system
supports duperemove. This allows us to move three tests from shared/
to generic/. This means these tests will automatically adapt when
duperemove supports other file systems. Tests moved are:
Theodore Ts'o [Fri, 28 Jun 2019 22:59:09 +0000 (18:59 -0400)]
shared,generic: move shared/006 to generic/
The shared/006 uses _scratch_mkfs_sized to create a limited size
file system, and then creates inodes until it gets ENOSPC, and then
checks to make sure the file system is consistent. It then remounts
the file system, removes all of the files, and makes sure the file
system is consistent afterwards. This test was marked as only being
supported on ext[234] and xfs, and so it was in shared.
Now introduce a new _require_inode_limits() rule to run test on
filesystems that have a fixed inode number, then move the test to
generic.
Theodore Ts'o [Fri, 28 Jun 2019 22:59:07 +0000 (18:59 -0400)]
check: add ext4 group list when testing ext2 and ext3
Modern kernels use the ext4 implementation to support ext2 and ext3
mounts, and a number of the ext4 tests are actually suitable for
ext2 and ext3. We're trying to move tests out of shared anyway, so
instead of moving tests from ext4/NNN to shared, let's just include
the ext4 group list when FSTYP is ext2 or ext3.
Theodore Ts'o [Fri, 28 Jun 2019 22:59:06 +0000 (18:59 -0400)]
shared,ext4: move ext4-specific tests out of shared/
The tests shared/{001,003,004,272} test behaviour around the ext4's
journal. As such, they are pointless to run on ext2, and ext3 no
longer is in kernels newer than 4.3. (And most enterprise
distributions have been using ext4 to support the ext3 file system;
that capability has been around since 2.6.33.) So we can move these
tests out of shared and into the ext4 class of tests:
Eric Biggers [Mon, 1 Jul 2019 17:12:55 +0000 (10:12 -0700)]
common/encrypt: check that contents encryption is usable
In _require_encryption_policy_support(), when checking whether the
encryption policy is usable, try creating a nonempty file rather
than an empty one. This ensures that both the contents and
filenames encryption modes are available, rather than just the
filenames mode.
On f2fs this makes generic/549 be correctly skipped, rather than
failed, when run on a kernel built from the latest fscrypt.git tree
with CONFIG_CRYPTO_SHA256=n.
Zorro Lang [Wed, 19 Jun 2019 10:10:47 +0000 (18:10 +0800)]
xfs: project quota ineritance flag test
This case is used to cover xfsprogs bug fixed by commit b136f48b19a5
("xfs_quota: fix false error reporting of project inheritance flag
is not set") at first. Then test more behavior when project
ineritance flag is set or removed.
Murphy Zhou [Thu, 27 Jun 2019 09:00:59 +0000 (17:00 +0800)]
generic/486: filter out irrelevant attrs
In some setup, there could be extra attrs printed, like selinux.
They are breaking golden output and irrelevant for this test.
So focus on the attr we are testing on to avoid false alarm.
Print the output to .full for debug.
Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Tue, 18 Jun 2019 21:07:37 +0000 (14:07 -0700)]
xfs: check for COW overflows in i_delayed_blks
With the new copy on write functionality it's possible to reserve so
much COW space for a file that we end up overflowing i_delayed_blks.
The only user-visible effect of this is to cause totally wrong i_blocks
output in stat, so check for that.
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>
Amir Goldstein [Tue, 18 Jun 2019 06:43:55 +0000 (09:43 +0300)]
overlay/061: remove from auto and quick groups
In late 2016, tests overlay/01[6-8] where merged to track the
state of several ilong standing posix compliance issues on overlayfs.
This practice was somewhat of an exception for xfstests project,
which more often merges tests for issues that are expected to be
resolved in the short term.
Over the years, some test cases have been fixed and more tests
where created to cover the remaining issues (e.g. overlay/04[34]).
Currently, the only failing test from this category is overlay/061
which covers item b) in the "Non-standard behavior" section of
Documentation/filesystems/overlayfs.txt.
Since there is no clear design, roadmap nor allocated resources
to resolve this remaining issue, the test is removed from the
"auto" and "quick" groups, following a suggestion that Darrick
has made for a similarly long failing generic test.
The test was added to the new "posix" group, to allow testing
for posix compliance.
Darrick J. Wong [Tue, 18 Jun 2019 21:07:08 +0000 (14:07 -0700)]
dump: _cleanup_dump should only check the scratch fs if the test required it
_cleanup_dump always tries to check the scratch fs, even if the caller
didn't actually _require_scratch. If a previous test wrote garbage to
the scratch device then the dump test will fail here when repair
stumbles over the garbage.
This was observed by running xfs/016 and xfs/036 in succession. xfs/016
writes 0xc6 to the scratch device and tries to format a small log. If
the log is too small the format fails and the test will _notrun. The
subsequent xfs/036 will _notrun and then _cleanup_dump if no tape device
is set, at which point we try to check the scratch device and logprint
aborts due to the abnormal log size (0xc6c6c6c6).
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Allison Collins <allison.henderson@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Amir Goldstein [Mon, 17 Jun 2019 13:58:43 +0000 (16:58 +0300)]
overlay: fix _scratch_remount with xfs_info 5.0.0
xfs_info version 5.0.0 started using findmnt to find the
filesystem to query. This change resulted in a regression
of _scratch_remount when testing overlay over xfs.
For example, test overlay/035, started to report:
[not run] overlay/035 -- upper fs needs to support d_type
Internally, '_overlay_scratch_mount -o remount' calls
'_supports_filetype $OVL_BASE_SCRATCH_MNT -o remount'
and with the following example mounts:
'_supports_filetype /vdf' returns false and reports:
"/vdf/ovl-mnt: Not on a mounted XFS filesystem".
Regardless of the change in xfs_info, which I proposed a fix
for, there is no reason to test d_type support on remount.
Therefore, fix the regression by skipping unneeded overlayfs
mount logic on remount.
Amir Goldstein [Tue, 11 Jun 2019 16:08:38 +0000 (19:08 +0300)]
fstests: check for filesystem FS_IOC_FSSETXATTR support
With "_require_xfs_io_command chattr <letter>", check that
flag can be set/cleared using FS_IOC_FSSETXATTR ioctl, similar
to "_require_chattr <letter>" and FS_IOC_SETFLAGS ioctl.
Update the documentation and the tests that use
"_require_xfs_io_command chattr" to test filesystem support
and not only xfs_io support.
Amir Goldstein [Tue, 11 Jun 2019 16:08:37 +0000 (19:08 +0300)]
common/rc: print out xfs_io parameter when command fails
In _require_xfs_io_command, when command fails for one of the
generic reasons, if command was tested with params, print out
the params of the failed command.
Filipe Manana [Wed, 12 Jun 2019 10:05:44 +0000 (11:05 +0100)]
btrfs/146: remove unnecessary scratch unmount to avoid test failure
Right at the beginning of the test we are unmonting the scratch device,
however at this point the device was never mounted, so the unmount fails
with an error message like the following:
umount: /home/fdmanana/btrfs-tests/scratch_1: not mounted
Which is not expected by the golden output and therefore causes the test
to fail.
Since the device/mount point was not mounted yet in the test, and since
the test framework unmounts the scratch device after each test finishes,
just remove the call to _scratch_unmount.
Amir Goldstein [Sun, 9 Jun 2019 17:12:29 +0000 (20:12 +0300)]
fstests: don't oom the box opening tmpfiles (take 2)
For the t_open_tmpfiles tests that run multiple jobs in parallel,
limit ourselves to half of file-max for all jobs combined,
so that we don't OOM the test machine.
Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Theodore Ts'o [Mon, 10 Jun 2019 02:42:54 +0000 (22:42 -0400)]
ext4/035: skip this test if DAX is in use
This test creates a file system with a 1k block size. Since there
are no architectures with a 1k page size, the test file system can
never be mounted with DAX enabled, causing the test to fail.
Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: Yang Xu <xuyang2018.jy@cn.fujitsu.com> Reviewed-by: Yang Xu<xuyang2018.jy@cn.fujitsu.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Amir Goldstein [Tue, 11 Jun 2019 15:39:16 +0000 (18:39 +0300)]
generic/554: test only copy to active swap file
Depending on filesystem, copying from active swapfile may be allowed,
just as read from swapfile may be allowed.
Note the kernel fix commit in test description.
Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Amir Goldstein [Tue, 11 Jun 2019 15:39:15 +0000 (18:39 +0300)]
generic/553: fix test description
The test only checks copy to immutable file.
Note the kernel fix commit.
Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Theodore Ts'o [Sun, 9 Jun 2019 21:04:31 +0000 (17:04 -0400)]
report: gracefully handle XML report creation when no tests are run
If no tests are run (because they have all been excluded) then make
sure we insert a valid timestamp into the XML file, and avoid printing
an error message when reading a non-existent test summary scratch
file.
Darrick J. Wong [Tue, 4 Jun 2019 21:16:49 +0000 (14:16 -0700)]
check: try to insulate the test framework from oom killer
Some of the tests in xfstests (e.g. generic/224 with 512M of memory)
consume a lot of memory, and when this happens the OOM killer will
run around stomping on processes. Sometimes it kills the ./check
process before it kills the actual test, which means that the test
run doesn't complete.
Therefore, make the ./check process OOM-proof while bumping up the
attractiveness of the test itself, in the hopes that even if the
test OOMs we'll still be able to continue on our way.
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>
Filipe Manana [Thu, 6 Jun 2019 11:07:47 +0000 (12:07 +0100)]
generic: test for data loss on fsync after evicting an inode and renaming it
Check that if we write some data to a file, its inode gets evicted
(while its parent directory's inode is not evicted due to being in
use), then we rename the file and fsync it, after a power failure
the file data is not lost.
This currently passes on xfs, ext4 and f2fs but fails on btrfs. The
following patch for btrfs fixes it:
"Btrfs: fix data loss after inode eviction, renaming it, and fsync it"
Naohiro Aota [Fri, 7 Jun 2019 05:39:10 +0000 (14:39 +0900)]
btrfs/163: make readahead run on the seed device
There is a long lived bug that btrfs wait for readahead to finish
indefinitely when readahead zone is inserted into seed devices.
Current write size to the file "foobar" is too small to run readahead
before the replacing on seed device. So, increase the write size to
reproduce the issue.
Amir Goldstein [Tue, 28 May 2019 08:27:14 +0000 (11:27 +0300)]
overlay: Test mount error cases with overlapping layers
Add tests for overlayfs mounts with:
- Same upperdir/lowerdir
- Overlapping upperdir/lowerdir
- Overlapping lowerdir layers
- Overlapping lowerdir with other mount upperdir/workdir
Add test for moving layer into another after mount.
Overlapping layers on mount or lookup results in ELOOP.
Overlapping lowerdir with other mount upperdir/workdir
result in EBUSY.
zhangyi (F) [Tue, 28 May 2019 15:17:23 +0000 (18:17 +0300)]
overlay: fix exit code for some fsck.overlay valid cases
Some valid test cases about fsck.overlay may be not valid enough now,
they lose the impure xattr on the parent directory of the simluated
redirect directory, and lose the whiteout which use to cover the origin
lower object. Then fsck.overlay will fix these two inconsistency which
are not those test cases want to cover, thus it will lead to
fsck.overlay return FSCK_NONDESTRUCT instead of FSCK_OK. Fix these by
complement the missing overlay related features.
zhangyi (F) [Tue, 28 May 2019 15:17:22 +0000 (18:17 +0300)]
overlay: correct fsck.overlay exit code
fsck.overlay should return correct exit code to show the file system
status after fsck, instead of return 0 means consistency and !0 means
inconsistency or something bad happened.
Fix the following three exit code after running fsck.overlay:
- Return FSCK_OK if the input file system is consistent,
- Return FSCK_NONDESTRUCT if the file system inconsistent errors
corrected,
- Return FSCK_UNCORRECTED if the file system still have inconsistent
errors.
This patch also add a helper function to run fsck.overlay and check
the return value is expected or not.
[amir] rename helper to _overlay_fsck_expect, split define of FSCK_*
to a seprate path.
Amir Goldstein [Tue, 28 May 2019 15:17:21 +0000 (18:17 +0300)]
overlay: fix _repair_scratch_fs
_repair_scratch_fs did not do the right thing for overlay.
Implement and call _repair_overlay_scratch_fs to repair
overlay filesystem and then fall through to repair base filesystem.
The only tests currentrly calling _repair_scratch_fs on a
./check -overlay run are generic/330 generic/332 in case the
base fs supports reflink. The rest of the tests calling
_repair_scratch_fs require that $SCRATCH_DEV is a block device.
Anthony Iliopoulos [Tue, 28 May 2019 16:27:44 +0000 (18:27 +0200)]
xfs/278: use _scratch_xfs_repair helper instead of xfs_repair
Use _scratch_xfs_repair helper instead of calling xfs_repair
directly, as local.config may want to define $XFS_REPAIR_PROG
and override the default binary in the search path.
Zorro Lang [Mon, 13 May 2019 01:49:04 +0000 (09:49 +0800)]
generic: aio random write and verify stress test
We found some AIO write related bugs recently, so I think a AIO
random write test is needed. By the new aio-aio-write-verify.c tool,
we can do this easily.
Eric Biggers [Fri, 24 May 2019 22:04:22 +0000 (15:04 -0700)]
common/encrypt: add helper for ciphertext verification tests
Introduce a function _verify_ciphertext_for_encryption_policy() which
verifies the correctness of encryption with the specified settings.
Basically, it does the following:
1. If missing any prerequisites, skip the test.
2. Create files in encrypted directories on the scratch device.
3. Unmount the scratch device and compare the actual ciphertext stored
on-disk to the ciphertext computed by the fscrypt-crypt-util program.
Both file contents and names are verified, and non-default encryption
modes are supported. Previously, non-default encryption modes were
untested by xfstests. Also, while there's an existing test generic/399
that checks that encrypted contents seem random, it doesn't actually
test for correctness, nor does it test filenames encryption.
Eric Biggers [Fri, 24 May 2019 22:04:21 +0000 (15:04 -0700)]
common/encrypt: support requiring other encryption settings
Update _require_scratch_encryption() to support checking for kernel
support for contents and filenames encryption modes besides the default.
This will be used by some of the ciphertext verification tests.
Eric Biggers [Fri, 24 May 2019 22:04:20 +0000 (15:04 -0700)]
fscrypt-crypt-util: add utility for reproducing fscrypt encrypted data
Add a utility program that can reproduce encrypted contents and
filenames. It implements all encryption algorithms currently supported
by fscrypt (a.k.a. ext4, f2fs, and ubifs encryption), and it generates
IVs in the same way. The program takes the algorithm and master key on
the command line, and encrypts stdin to stdout.
A file nonce may also be passed on the command line, and the program
will "tweak" the encryption using this nonce in the same way the kernel
does -- either by deriving a subkey, or by including the nonce in the
IVs. The block size and padding amount may also be specified.
No dependencies are added, as all algorithms implemented from scratch.
Eric Biggers [Fri, 24 May 2019 22:04:19 +0000 (15:04 -0700)]
common/encrypt: introduce helpers for set_encpolicy and get_encpolicy
For conciseness in tests, add helper functions that wrap the xfs_io
commands 'set_encpolicy' and 'get_encpolicy'. Then update all
encryption tests to use them.
Luis Henriques [Fri, 17 May 2019 15:56:35 +0000 (16:56 +0100)]
generic/{436,445}: define _cleanup function earlier in the tests
If the filesystem doesn't support a feature that is required for the tests
to run, they will fail to execute the _cleanup function because it isn't yet
defined:
./common/rc: line 1: _cleanup: command not found
This error became more visible with commit 87a53d2e7c82 ("generic/{436,445}:
check falloc support").
Cc: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Luis Henriques <lhenriques@suse.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Mon, 20 May 2019 22:31:10 +0000 (15:31 -0700)]
fstests: use _scratch_shutdown instead of calling src/godown
Overlayfs introduces some complexity with regards to what path we have
to use to shut down the scratch filesystem: it's SCRATCH_MNT for regular
filesystems, but it's OVL_BASE_SCRATCH_MNT (i.e. the lower mount of the
overlay) if overlayfs is enabled. The helper works through all that, so
we might as well use it.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Mon, 20 May 2019 22:31:04 +0000 (15:31 -0700)]
generic/530, xfs/501: pass fs shutdown handle to t_open_tmpfiles
So it turns out that overlayfs can't pass FS_IOC_SHUTDOWN to the lower
filesystems and so xfstests works around this by creating shutdown
helpers for the scratch fs to direct the shutdown ioctl to wherever it
needs to go to shut down the filesystem -- SCRATCH_MNT on normal
filesystems and OVL_BASE_SCRATCH_MNT when -overlay is enabled. This
means that t_open_tmpfiles cannot simply use one of the open tempfiles
to shut down the filesystem.
Commit f8f57747222 tried to "fix" this by ripping the shutdown code out,
but this made the tests useless. Fix this instead by creating a
xfstests helper to return a path that can be used to shut down the
filesystem and then pass that path to t_open_tmpfiles so that we can
shut down the filesystem when overlayfs is enabled.
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>
Commit f8f57747222 ("generic/530: fix shutdown failure of generic/530 in
overlay") improperly clears an overlayfs test failure by shutting down
the filesystem after all the tempfiles are closed, which totally defeats
the purpose of both generic/530 and xfs/501. Revert this commit so we
can fix it properly.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>