Christian Brauner [Thu, 12 May 2022 16:52:38 +0000 (18:52 +0200)]
idmapped-mounts: make all tests set their required feature flags
In commit 858a19c5e9b0 ("idmapped_mounts: Prepare for support for more
features") we introduced a flag argument to check for multiple features
and then decide based on the flag argument whether a test requires a
given feature and skip it if the kernel doesn't provide it.
However, not all tests were ported to the new flag argument and still
use the old infrastructure. Port them all.
Fixes: 858a19c5e9b0 ("idmapped_mounts: Prepare for support for more features") Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
Baokun Li [Wed, 11 May 2022 08:34:04 +0000 (16:34 +0800)]
common: xfstests support overlay+tmpfs
The local.config of overlay+tmpfs is as follows:
```local.config.example
export FSTYP=tmpfs
export TEST_DEV=tmpfs_test
export TEST_DIR=/tmp/test
export SCRATCH_DEV=tmpfs_scratch
export SCRATCH_MNT=/tmp/scratch
```
Run `./check -overlay tests` to execute test case on overlay+tmpfs.
Signed-off-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Yang Xu [Tue, 10 May 2022 05:24:50 +0000 (13:24 +0800)]
generic/68[3-7]: Add separate sgid stripping sub-tests
Like xfstests commit 298f60c ("generic/673: Add separate sgid stripping sub-tests"),
we should also add separate sgid stripping sub-tests for each fallocate operation.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
Eric Biggers [Sat, 30 Apr 2022 19:21:30 +0000 (12:21 -0700)]
ext4/053: fix the rejected mount option testing
'not_mnt OPTIONS' seems to have been intended to test that the
filesystem cannot be mounted at all with the given OPTIONS, meaning that
the mount fails as opposed to the options being ignored. However, this
doesn't actually work, as shown by the fact that the test case 'not_mnt
test_dummy_encryption=v3' is passing in the !CONFIG_FS_ENCRYPTION case.
Actually ext4 ignores this mount option when !CONFIG_FS_ENCRYPTION.
(The ext4 behavior might be changed, but that is besides the point.)
The problem is that the do_mnt() helper function is being misused in a
context where a mount failure is expected, and it does some additional
remount tests that don't make sense in that context. So if the mount
unexpectedly succeeds, then one of these later tests can still "fail",
causing the unexpected success to be shadowed by a later failure, which
causes the overall test case to pass since it expects a failure.
Fix this by reworking not_mnt() and not_remount_noumount() to use
simple_mount() in cases where they are expecting a failure. Also fix
up some of the naming and calling conventions to be less confusing.
Finally, make sure to test that remounting fails too, not just mounting.
Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Filipe Manana [Mon, 9 May 2022 14:31:02 +0000 (15:31 +0100)]
generic: test fsync of directory with renamed symlink
Test that if we fsync a directory, create a symlink inside it, rename
the symlink, fsync again the directory and then power fail, after the
filesystem is mounted again, the symlink exists with the new name and
it has the correct content.
This currently fails on btrfs, because the symlink ends up empty (which
is illegal on Linux), but it is fixed by kernel commit:
d0e64a981fd841 ("btrfs: always log symlinks in full mode")
Reviewed-by: David Disseldorp <ddiss@suse.de> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Yang Xu [Sat, 7 May 2022 16:01:27 +0000 (00:01 +0800)]
idmapped-mounts: Add open with O_TMPFILE operation in setgid test
Since we can create temp file by using O_TMPFILE flag and filesystem driver also
has this api, we should also check this operation whether strip S_ISGID.
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Yang Xu [Sat, 7 May 2022 16:01:26 +0000 (00:01 +0800)]
idmapped-mounts: Add mknodat operation in setgid test
Since mknodat can create file, we should also check whether strip S_ISGID.
Also add new helper caps_down_fsetid to drop CAP_FSETID because strip S_ISGID
depend on this cap and keep other cap(ie CAP_MKNOD) because create character
device needs it when using mknod.
Only test mknodat with character device in setgid_create function and the another
two functions test mknodat with whiteout device.
Since kernel commit a3c751a50 ("vfs: allow unprivileged whiteout creation") in
v5.8-rc1, we can create whiteout device in userns test. Since kernel 5.12, mount_setattr
and MOUNT_ATTR_IDMAP was supported, we don't need to detect kernel whether allow
unprivileged whiteout creation. Using fs_allow_idmap as a proxy is safe.
Tested-by: Christian Brauner (Microsoft)<brauner@kernel.org> Reviewed-by: Christian Brauner (Microsoft)<brauner@kernel.org> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Yang Xu [Sat, 7 May 2022 16:01:25 +0000 (00:01 +0800)]
idmapped-mounts: Reset errno to zero before run_test
If we run case on old kernel that doesn't support mount_setattr and
then fail on our own function before call is_setgid/is_setuid function
to reset errno, run_test will print "Function not implement" error.
We also check whether system support user namespace, so reset errno to
zero after userns check.
Acked-by: Christian Brauner (Microsoft) <brauner@kernel.org> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Chandan Babu R [Fri, 6 May 2022 09:57:46 +0000 (15:27 +0530)]
xfs/533: Delete test since directory's extent count can never overflow
The maximum file size that can be represented by the data fork extent counter
in the worst case occurs when all extents are 1 block in length and each block
is 1KB in size.
With XFS_MAX_EXTCNT_DATA_FORK_SMALL representing maximum extent count and with
1KB sized blocks, a file can reach upto,
(2^31) * 1KB = 2TB
This is much larger than the theoretical maximum size of a directory
i.e. XFS_DIR2_SPACE_SIZE * 3 = ~96GB.
Since a directory can never overflow its data fork extent counter, the xfs
kernel driver removed code which checked for such a situation before any
directory modification operation could be executed. Instead, the kernel driver
verifies the sanity of directory's data fork extent counter when the inode is
read from disk.
This commit removes the test xfs/533 due to the reasons mentioned above.
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
Dave Chinner [Fri, 6 May 2022 05:10:17 +0000 (15:10 +1000)]
fstests: faster group file creation
We don't need to execute every test just to check it's groups are
valid. Just grab all the groups with grep, pull out the unique ones,
then check them.
This also avoids the problem of editor swap files being present in
the test directory and breaking the build because they are not
executable.
Building on a clean, already built tree so it only builds the
group lists:
$ time make
....
Building udf
[GROUP] /home/dave/src/xfstests-dev/tests/udf/group.list
Building xfs
[GROUP] /home/dave/src/xfstests-dev/tests/xfs/group.list
real 0m36.917s
user 0m15.032s
sys 0m26.219s
$
Patched:
$ time make
....
Building udf
[GROUP] /home/dave/src/xfstests-dev/tests/udf/group.list
Building xfs
[GROUP] /home/dave/src/xfstests-dev/tests/xfs/group.list
groups "frobnozzle" not mentioned in documentation.
gmake[3]: *** [../../include/buildgrouplist:8: group.list] Error 1
gmake[2]: *** [../include/buildrules:31: xfs] Error 2
gmake[1]: *** [include/buildrules:31: tests] Error 2
make: *** [Makefile:51: default] Error 2
real 0m1.751s
user 0m0.863s
sys 0m1.067s
$
Just a little bit faster, and as you can see that it still detects
groups that are not documented. There was also an open .001.swp file
in the XFS directory and that doesn't throw a failure anymore,
either.
Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Zorro Lang <zlang@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
Amir Goldstein [Tue, 19 Apr 2022 12:56:37 +0000 (15:56 +0300)]
common: print hints for reasons of test failures
Introduce helpers _fixed_by_{kernel,git}_commit() and
_fixed_in_{kernel_,}version() that can be used to hint testers why a
test might be failing and aid in auto-generating of expunge lists for
downstream kernel testing.
A test may be annotated with multiple hints, for example:
Annotate fix kernel commits for some overlayfs tests.
Annotate fix kernel version for some overlayfs tests testing
for legacy behavior whose fixes are not likely to be backported
to stable kernels.
This is modeled after LTP's 'make filter-known-fails' and
print_failure_hints() using struct tst_tag annotations.
Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Amir Goldstein [Tue, 19 Apr 2022 12:56:36 +0000 (15:56 +0300)]
common: support black listing fs in _supported_fs()
For example:
_supported_fs ^xfs
There is no need to specify "generic" when using a block list
"all other fs are supported" is implied.
Converted some generic tests that open code this condition without
emitting a meaningful reason.
More generic test like generic/186,187 could use a block list, but
were not converted because they emit some meaningful reason:
_notrun "Can't fragment free space on btrfs."
Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Josef Bacik [Thu, 28 Apr 2022 15:05:00 +0000 (11:05 -0400)]
fstests: add some missing _require_loop's
Got a new box running overnight fstests and noticed a couple of failures
because I forgot to enable loop device support. Fix these two tests to
have _require_loop so they don't fail if there's no loop device support.
Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
Zorro Lang [Tue, 26 Apr 2022 06:24:11 +0000 (14:24 +0800)]
fsstress: remove ALLOCSP and FREESP operations entirely
Due to upstream linux has removed ALLOCSP/FREESP ioctls by commit: 4d1b97f9ce7c0 ("xfs: kill the XFS_IOC_{ALLOC,FREE}SP* ioctls"), so
let's remove ALLOCSP/FREESP testing from fsstress, to avoid more
mismatch problems.
Due to g/070 specified "-f allocsp" and "-f freesp=0", so remove
these two lines too.
Signed-off-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
fstests: btrfs: test setting compression via xattr on nodatacow files
Compression and nodatacow are mutually exclusive. Besides ioctl, there
is another way to setting compression via xattrs, and shouldn't produce
invalid combinations.
Signed-off-by: Chung-Chiang Cheng <cccheng@synology.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Eric Sandeen [Tue, 26 Apr 2022 05:14:53 +0000 (00:14 -0500)]
fstests: remove xfs/144
This test was designed to validate the quota warning limit, which in
theory was supposed to migrate from a soft quota to hard enforcement
after a certain number of warnings. However, the xfs kernel commit
which incremented the warning counter was reverted; see:
xfs: revert "xfs: actually bump warning counts when we send warnings"
in the kernel tree for an explanation of why. Due to that revert,
which removed this functionality, remove this test.
Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
generic/681, generic/682: add debugging information to $seqreq.full
These two tests are checking whether a non-privileged user causing a
block allocation while expanding a directory block when over quota
will fail with an EDQUOT error. There are three reasons why this can
fail.
* Aa test bug, where if the file system is using cluster allocation
(for example, ext4 bigalloc) the test doesn't add enough directory
entries to actually force directory grwoth.
* A file system bug, where the file system allocates blocks but for
some reason isn't charging the space quota correctly (which
currently seems to be the case in ext4 with fscrypt).
* A file system bug, where the file system is correctly charging the
space quota to the unprivileged user, but isn't failing the system
call with EDQUOT.
By adding some additional debugging information about whether
directory has grown or not (in addition to the existing repquota
output) to the the $seqres.full, it makes easier for the file system
developer to disambiguate between these possibilities. It's cheap to
do this, and it could save developer time when trying to root cause
the failure.
Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
After coreutils rebasing to 9.1, chown(1) behavior changes:
"
chown and chroot now warn about usages like "chown root.root f",
which have the nonstandard and long-obsolete "." separator that
causes problems on platforms where user names contain ".".
Applications should use ":" instead of ".".
"
https://lwn.net/Articles/891574/
With this behavior change, old format of ownership string will cause
warning like this:
"
+chown: warning: '.' should be ':': '1000.1000'
+.chown: warning: '.' should be ':': '1100.1100'
+.chown: warning: '.' should be ':': '1200.1200'
+.chown: warning: '.' should be ':': '1300.1300'
+.chown: warning: '.' should be ':': '1400.1400'
"
The new format works fine with old versions of coreutils.
Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com> Reviewed-by: Zorro Lang <zlang@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
Christian Brauner [Wed, 20 Apr 2022 17:52:22 +0000 (19:52 +0200)]
generic: add test for tmpfs POSIX ACLs
Add a regression test for commit 705191b03d50 ("fs: fix acl translation").
This tests whether setting POSIX ACLs on a tmpfs mounted in a
non-initial user and mount namespace works as expected.
Note, once again the idmapped mount testsuite is grossly misnamed at
this point. It has morphed into a full-blown generic vfs feature
testsuite.
Cc: Eryu Guan <guaneryu@gmail.com> Cc: Seth Forshee <sforshee@digitalocean.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Zorro Lang <zlang@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org> Reviewed-by: Zorro Lang <zlang@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
Darrick J. Wong [Tue, 19 Apr 2022 17:32:15 +0000 (10:32 -0700)]
xfs: make sure syncfs(2) passes back super_operations.sync_fs errors
This is a regression test to make sure that nonzero error returns from
a filesystem's ->sync_fs implementation are actually passed back to
userspace when the call stack involves syncfs(2).
[zlang@ add '_supported_fs xfs' in case]
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Rishabh Dave [Tue, 19 Apr 2022 17:58:11 +0000 (23:28 +0530)]
cephfs: add ceph-fuse suport for ceph-fuse
Currently tests in xfstests-dev can be executed against CephFS only by
mounting CephFS using kernel driver. Attempting to run tests against
CephFS using FUSE doesn't work because xfstests-dev would remount CephFS
using kernel. This patch adds the ability for xfstest-dev code to mount
CephFS using FUSE.
[Zorro add missed ";;" in common/rc]
Fixes: https://tracker.ceph.com/issues/55354 Signed-off-by: Rishabh Dave <ridave@redhat.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Darrick J. Wong [Tue, 19 Apr 2022 17:32:00 +0000 (10:32 -0700)]
xfs/019: fix golden output for files created in setgid dir
A recent change to xfs/019 exposed a long-standing bug in mkfs where
it would always set the gid of a new child created in a setgid directory
to match the gid parent directory instead of what's in the protofile.
Ignoring the user's directions is not the correct behavior, so update
this test to reflect that. Also don't erase the $seqres.full file,
because that makes forensic analysis pointlessly difficult.
Cc: Catherine Hoang <catherine.hoang@oracle.com> Fixes: 7834a740 ("xfs/019: extend protofile test") Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Catherine Hoang <catherine.hoang@oracle.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Eric Sandeen [Mon, 18 Apr 2022 17:03:26 +0000 (01:03 +0800)]
xfs: test xfsdump when an inode < root inode is present
This tests a longstanding bug where xfsdumps are not properly
created when an inode is present on the filesytsem which has
a lower number than the root inode.
Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Zorro Lang [Wed, 20 Apr 2022 16:07:56 +0000 (00:07 +0800)]
fstests: remove _wipe_fs from dump testing entirely
The _wipe_fs function in common/dump is a historical remnant of
xfstests, it's easy to cause confusion now. Now xfstests tend to
call `require_scratch && scratch_mkfs && scratch_mount` in each case
itself, we don't need to use a function to do that specially, so
remove _wipe_fs entirely.
Signed-off-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Jan Kara [Thu, 31 Mar 2022 11:19:20 +0000 (13:19 +0200)]
generic/633: Avoid failure without CONFIG_USER_NS
Some tests in idmapped_mounts fail without CONFIG_USER_NS because they
have implicit dependence on user namespaces and these tests are run
despite idmapped mount support not being detected. Detect whether at
least user namespaces are supported and skip tests needing them when
they are not.
Signed-off-by: Jan Kara <jack@suse.cz> Tested-by: Christian Brauner (Microsoft) <brauner@kernel.org> Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
Jan Kara [Thu, 31 Mar 2022 11:19:19 +0000 (13:19 +0200)]
idmapped_mounts: Prepare for support for more features
Currently idmapped_mounts tests fail for kernels without CONFIG_USER_NS
because some tests are run despite missing support for idmapped mounts
and they implicitely require user namespace support. Prepare
idmapped_mounts to support more features a test may require to reliably
run.
Signed-off-by: Jan Kara <jack@suse.cz> Tested-by: Christian Brauner (Microsoft) <brauner@kernel.org> Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
Darrick J. Wong [Mon, 11 Apr 2022 22:54:54 +0000 (15:54 -0700)]
generic: test that renaming into a directory fails with EDQUOT
Add a regression test to make sure that unprivileged userspace renaming
within a directory fails with EDQUOT when the directory quota limits have
been exceeded.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Mon, 11 Apr 2022 22:54:48 +0000 (15:54 -0700)]
generic: test that linking into a directory fails with EDQUOT
Add a regression test to make sure that unprivileged userspace linking
into a directory fails with EDQUOT when the directory quota limits have
been exceeded.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Dave Chinner [Mon, 11 Apr 2022 05:48:33 +0000 (15:48 +1000)]
generic/019: kill background processes on interrupt
If you ctrl-c generic/019, it leaves fsstress processes running.
Kill them in the cleanup function so that they don't have to be
manually killed after interrupting the test.
While touching the _cleanup() function, make it do everything that
the generic _cleanup function it overrides does and fix the
indenting.
[Eryu: unset fs_pid and fio_pid after wait]
Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: David Disseldorp <ddiss@suse.de> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Mon, 11 Apr 2022 22:55:02 +0000 (15:55 -0700)]
common/rc: let xfs_scrub tell us about its unicode checker
Now that xfs_scrub can report whether or not it was built with the
Unicode name checker, rewrite _check_xfs_scrub_does_unicode to take
advantage of that. This supersedes the old method of trying to observe
dynamic library linkages and grepping the binary, neither of which
worked very well.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
LuÃs Henriques [Wed, 23 Mar 2022 16:09:25 +0000 (16:09 +0000)]
ceph/001: add extra check for remote object copies
Ceph kernel client now has a facility to check stats for certain
operations. One of these operations is the 'copyfrom', the
operation that is used to offload to the OSDs the copy of objects
from, for example, the copy_file_range() syscall.
This patch changes ceph/001 to add an extra check to verify that the
copies performed by the test are _really_ remote copies and not
simple read+write operations.
Eric Whitney [Thu, 14 Apr 2022 14:22:58 +0000 (10:22 -0400)]
common/filter: extend _filter_xfs_io to match -nan
When run on ext4 with sufficiently fast x86_64 hardware, generic/130
sometimes fails because xfs_io can report rate values as -nan:
0.000000 bytes, 0 ops; 0.0000 sec (-nan bytes/sec and -nan ops/sec)
_filter_xfs_io matches the strings 'inf' or 'nan', but not '-nan'. In
that case it fails to convert the actual output to a normalized form
matching generic/130's golden output. Extend the regular expression
used to match xfs_io's output to fix this.
Signed-off-by: Eric Whitney <enwlinux@gmail.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Eric Biggers [Thu, 14 Apr 2022 07:19:32 +0000 (00:19 -0700)]
common/encrypt: use a sub-keyring within the session keyring
Make the encryption tests create and use a named keyring "xfstests" in
the session keyring that the tests happen to be running under, rather
than replace the session keyring using 'keyctl new_session'.
Unfortunately, the latter doesn't work when the session keyring is owned
by a non-root user, which (depending on the Linux distro) can happen if
xfstests is run in a sudo "session" rather than in a real root session.
This isn't a great solution, as the lifetime of the keyring will no
longer be tied to the tests as it should be, but it should work. The
alternative would be the weird hack of making the 'check' script
re-execute itself using something like 'keyctl session - $0 $@'.
Reported-by: Ritesh Harjani <ritesh.list@gmail.com> Signed-off-by: Eric Biggers <ebiggers@google.com>
Darrick J. Wong [Mon, 11 Apr 2022 22:54:22 +0000 (15:54 -0700)]
xfs/187: don't rely on FSCOUNTS for free space data
Currently, this test relies on the XFS_IOC_FSCOUNTS ioctl to return
accurate free space information. It doesn't. Convert it to use statfs,
which uses the accurate versions of the percpu counters. Obviously,
this only becomes a problem when we convert the free rtx count to use
(sloppier) percpu counters instead of the (more precise and previously
buggy) ondisk superblock counts.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
David Disseldorp [Wed, 13 Apr 2022 16:44:22 +0000 (18:44 +0200)]
generic/020: fix max_attrval_size output filter
The current attr -g "$max_attrval_name" output filter is broken if
$max_attrval_size isn't 16-byte aligned, due to od's duplicate
suppression behaviour.
Fix it by having od only dump one byte per line.
Signed-off-by: David Disseldorp <ddiss@suse.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
David Disseldorp [Wed, 13 Apr 2022 16:44:21 +0000 (18:44 +0200)]
generic/020: fix max_attrval_size for XFS, UDF, Btrfs and NFS
As found by Dave Chinner, fff4359d ("020: make this xattr test generic")
unintentionally changed the long attribute value length from 100K to 64
*bytes* for XFS, UDF and Btrfs.
Update XFS and UDF to use a 64K $max_attrval_size value. For Btrfs, use
the nodesize, xattr length and tree entry overhead sizes to calculate
the maximum.
NFS doesn't provide a way to find out the $max_attrval_size for the
underlying filesystem on the server, so just use a rough 1K limit.
David Disseldorp [Wed, 13 Apr 2022 16:44:20 +0000 (18:44 +0200)]
generic/020: add and use _attr_get_max()
In preparation for taking into account the attr name length when
calculating $MAX_ATTRVAL_SIZE, put the current logic in a
_attr_get_max() helper function and set local $max_attrval_size /
$max_attrs variables instead of using export.
Filipe Manana [Mon, 11 Apr 2022 14:08:38 +0000 (15:08 +0100)]
common/rc: fix _try_scratch_mount() and _test_mount() when mount fails
After the recent commit 4a7b35d7a76cd9 ("common: allow to run all tests
on idmapped mounts"), some test that use _try_scratch_mount started to
fail. For example:
btrfs/131 2s ... - output mismatch (see .../results//btrfs/131.out.bad)
--- tests/btrfs/131.out 2020-06-10 19:29:03.818519162 +0100
+++ /home/fdmanana/git/hub/xfstests/results//btrfs/131.out.bad (...)
@@ -6,8 +6,6 @@
Disabling free space cache and enabling free space tree
free space tree is enabled
Trying to mount without free space tree
-mount failed
-mount failed
Mounting existing free space tree
free space tree is enabled
...
(Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/btrfs/131.out ...
btrfs/220 7s ... - output mismatch (see .../results//btrfs/220.out.bad)
--- tests/btrfs/220.out 2020-10-16 23:13:46.802162554 +0100
+++ /home/fdmanana/git/hub/xfstests/results//btrfs/220.out.bad (...)
@@ -1,2 +1,32 @@
QA output created by 220
+Option fragment=invalid should fail to mount
+umount: /home/fdmanana/btrfs-tests/scratch_1: not mounted.
+Option nologreplay should fail to mount
+umount: /home/fdmanana/btrfs-tests/scratch_1: not mounted.
+Option norecovery should fail to mount
+umount: /home/fdmanana/btrfs-tests/scratch_1: not mounted.
...
(Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/btrfs/220.out ...
Ran: btrfs/131 btrfs/220
Failures: btrfs/131 btrfs/220
Failed 2 of 2 tests
The reason is that if _try_scratch_mount() fails to mount the filesystem,
we don't return the failure, instead we call _idmapped_mount(), which
can succeed and make _try_scratch_mount() return 0 (success). The same
happens for _test_mount(), however a quick search revealed no tests
currently relying on the return value of _test_mount().
So fix that by making _try_scratch_mount() return immediately if it gets
a mount failure. Also do the same for _test_mount().
Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com> Acked-by: Christian Brauner (Microsoft) <brauner@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Zorro Lang [Mon, 11 Apr 2022 16:37:10 +0000 (00:37 +0800)]
fstests: test dirty pipe vulnerability issue of CVE-2022-0847
Test for the Dirty Pipe vulnerability (CVE-2022-0847) caused by an
uninitialized "pipe_buffer.flags" variable. The bug cause a file
can be overwritten even if a user/process is not permitted to write
it. It's fixed by 9d2231c5d74e ("lib/iov_iter: initialize "flags" in
new pipe_buffer").
Cc: Max Kellermann <max.kellermann@ionos.com> Signed-off-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Zorro Lang [Mon, 11 Apr 2022 16:37:09 +0000 (00:37 +0800)]
fstests: replace hexdump with od command
The "od" is one of the most fundamental commands in GNU/Linux and
most Unix-like systems. So we nearly always can count on it, don't
need to check if it's installed.
The "hexdump" isn't such fundamental as "od", some systems don't
install it by default. And as "od" nearly can replace all functions
of "hexdump", so let's use an unified command "od" to do the hexdump
job in fstests cases.
Signed-off-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Christian Brauner [Thu, 7 Apr 2022 11:21:57 +0000 (13:21 +0200)]
common: allow to run all tests on idmapped mounts
In addition to the generic and filesystem-specific idmapped mount
testsuites that already exist upstream today add simple
infrastructure so any test can be run on idmapped mounts simply by
setting IDMAPPED_MOUNTS=true in the config file or section. The main
user for now will be overlay to verify it works correctly on
idmapped mounts.
Note that the infrastructure is completely generic so every
filesystem that supports idmapped mounts can simply run all of their
tests idmapped. But note that not all ways to create a mount have
been converted yet. That includes e.g. _dmthin_mount and direct
calls to _mount in various tests.
In addition, there will be corner-cases. For example, xfs doesn't
allow bulkstat on idmapped mounts because it is a filesystem wide
operation, i.e. you can retrieve information for any inode in the
filesystem so the operation cannot be scoped reasonably under a
single mount. So xfstests testing bulkstat will fail as it's
blocked. Similar for some btrfs ioctl()s.
While we could of course restrict this testmode to -overlay for
which we know things work correctly we should not do this. It would
mean that people won't start using it and so we won't see issues
unless someone sits down and goes through more than 1000 tests and
figures out for each individual one whether it needs to be skipped
or not.
So instead allow this mode but for all filesystems so people can
start running and reporting failures and we can fix them up or block
them as we detect them.
Cc: Eryu Guan <guaneryu@gmail.com> Cc: Christoph Hellwig <hch@lst.de> Cc: <fstests@vger.kernel.org> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/encrypt: allow the use of 'fscrypt:' as key prefix
fscrypt keys have used the $FSTYP as prefix. However this format is being
deprecated and newer kernels are expected to use the generic 'fscrypt:'
prefix instead. This patch adds support for this new prefix, and only
uses $FSTYP on filesystems that didn't initially supported it, i.e. ext4 and
f2fs. This will allow old kernels to be tested.
Zorro Lang [Wed, 30 Mar 2022 05:25:06 +0000 (13:25 +0800)]
fsx: remove XFS_IOC_ALLOCSP operation entirely
Due to XFS_IOC_ALLOCSP is nearly retired from linux xfs, and the
ALLOCSP testing in fsx easily trigger errors. So compare with
disable it by default, I'd like to remove it entirely. So this patch
revert two patches:
cd99a499 ("fsx: disable allocsp_calls if -F is specified") a32fb1bb ("fsx: add support for XFS_IOC_ALLOCSP")
Signed-off-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Pankaj Raghav [Fri, 25 Mar 2022 10:19:08 +0000 (11:19 +0100)]
btrfs/237: Use zone cap instead of zone size in fill_size and rest calculation
This test will break when zone capacity != zone size because the
calculation of the size to be filled is done using zone_size instead
of the actual capacity available per zone. Fix it by using zone
capacity.
As a zoned device can have variable capacity, use the btrfs utility
to get the zone capacity from the first data block group that the
test will be performed on.
The support to extract zone capacity was added to blkzone only from
version 2.37. So zcap will be used only when the blkzone version is
greater or equal to 2.37.
Catherine Hoang [Thu, 17 Mar 2022 23:24:08 +0000 (23:24 +0000)]
xfs/019: extend protofile test
This test creates an xfs filesystem and verifies that the filesystem
matches what is specified by the protofile.
This patch extends the current test to check that a protofile can
specify setgid mode on directories. Also, check that the created
symlink isn’t broken.
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Allison Henderson <allison.henderson@oracle.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Sun Ke [Wed, 23 Mar 2022 08:37:24 +0000 (16:37 +0800)]
generic/066: attr1 is still there after log replay on f2fs
The test fail on f2fs:
xattr names and values after second fsync log replay:
# file: SCRATCH_MNT/foobar
+user.attr1="val1"
user.attr3="val3"
attr1 is still there after log replay. f2fs doesn't support fs-op level
transaction functionality. so it have no way to persist all metadata
updates in one transaction. We can use "fastboot" mountoption for this
case, so during last fsync on qwerty, f2fs can trigger a checkpoint
which will persist all metadata updates before fsync().
Suggested-by: Chao Yu <chao@kernel.org> Signed-off-by: Sun Ke <sunke32@huawei.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Dai Shili [Fri, 25 Mar 2022 20:04:12 +0000 (16:04 -0400)]
generic/631: use trusted.* extended attributes to filter NFS filesystem
Since commit 2461e8901c ("generic/631: Add a check for extended
attributes"), check of user.* extended attributes was added to avoid
running this tests for filesystems that are not supported.
But it still fails on NFSv4.2 when mount overlayfs with the
following error.
/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: upper fs does not support xattr, falling back to index=off and metacopy=off.
As per the linux patch series(https://lwn.net/Articles/799185/ ), the
support of user extended attributes were added to NFSv4.2. So this
case passed the check of extended attributes by _require_attrs.
As per the overlayfs documentation -
"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."
So we can replace user.* extended attributes check with trusted.* to
filter NFS filesystem.
Nitesh Shetty [Wed, 23 Mar 2022 18:06:43 +0000 (23:36 +0530)]
generic/108: use blockdev utility to calculate physical and logical block size
Reading sysfs to get physical and logical block fails,
if SCRATCH_DEV is partitioned device.
Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com> Reported-by: Darrick J. Wong <djwong@kernel.org> Reported-by: Wang Yugui <wangyugui@e16-tech.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Filipe Manana [Thu, 17 Mar 2022 16:34:32 +0000 (16:34 +0000)]
generic: fallocate against a file range with a mix of holes and extents
Test that if we call fallocate against a file range that has a mix
of holes and written extents, the fallocate succeeds if the
filesystem has enough free space to allocate extents for the holes.
This test currently fails on btrfs and is fixed by a patch that has the
following subject:
"btrfs: only reserve the needed data space amount during fallocate"
The test also fails on xfs, and after some discussion with Darrick,
it seems it's due to technical reasons that would require a
significant effort to xfs's implementation, and at the moment there
isn't enough motivation to do such change. The relevent thread is at:
Eric Biggers [Sun, 13 Mar 2022 01:05:59 +0000 (17:05 -0800)]
common/encrypt: verify the key identifiers
As part of all the ciphertext verification tests, verify that the
filesystem correctly computed the key identifier from the key the test
generated. This uses fscrypt-crypt-util to compute the key identifier.
Previously this was only being tested indirectly, via the tests that
happen to use the hardcoded $TEST_RAW_KEY and $TEST_KEY_IDENTIFIER.
The new check provides better coverage.
Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Eric Biggers [Sun, 13 Mar 2022 01:05:57 +0000 (17:05 -0800)]
fscrypt-crypt-util: add support for dumping key identifier
Add an option to fscrypt-crypt-util to make it compute the key
identifier for the given key. This will allow testing the correctness
of the filesystem's key identifier computation.
Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Eric Biggers [Sun, 13 Mar 2022 01:05:56 +0000 (17:05 -0800)]
fscrypt-crypt-util: refactor get_key_and_iv()
Split get_key_and_iv() into two distinct parts: (1) deriving the key and
(2) generating the IV. Also, check for the presence of needed options
just before they are used rather than doing it all up-front.
These changes should make this code much easier to understand.
Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Eric Biggers [Sun, 13 Mar 2022 01:05:55 +0000 (17:05 -0800)]
fscrypt-crypt-util: use an explicit --direct-key option
Make fscrypt-crypt-util use an option --direct-key to specify the use of
the DIRECT_KEY method for key derivation and IV generation. Previously,
this method was implicitly detected via --mode-num being given without
either --iv-ino-lblk-64 or --iv-ino-lblk-32, or --kdf=none being given
in combination with --file-nonce.
The benefit of this change is that it makes the various options to
fscrypt-crypt-util behave more consistently. --direct-key,
--iv-ino-lblk-64, and --iv-ino-lblk-32 now all work similarly (they
select a key derivation and IV generation method); likewise, --mode-num,
--file-nonce, --inode-number, and --fs-uuid now all work similarly (they
provide information that key derivation and IV generation may need).
Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 16 Mar 2022 22:13:26 +0000 (15:13 -0700)]
xfs/17[013]: fix intermittent failures when filesystem metadata gets large
These tests check that the filestreams allocator never shares an AG
across multiple streams when there's plenty of space in the filesystem.
Recent increases in metadata overhead for newer features (e.g. bigger
logs due to reflink) can throw this off, so add another AG to the
formatted filesystem to encourage it to avoid the AG with the log.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 16 Mar 2022 22:12:32 +0000 (15:12 -0700)]
xfs/076: only create files on the data device
This test checks that filesystems with sparse inode support can continue
to allocate inodes when free space gets fragmented. Inodes only exist
on the data device, so we need to ensure that realtime is not enabled on
the filesystem so that the rt metadata doesn't mess with the inode usage
percentage and cause a test failure.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Darrick J. Wong [Wed, 16 Mar 2022 03:30:25 +0000 (20:30 -0700)]
generic/673: fix golden output to reflect vfs setgid behavior
Filipe Manana pointed out[1] that the setgid dropping behavior encoded
in this generic test is based on some outdated XFS code, and not based
on what the VFS inode attribute change functions actually do. Now that
we're working on fixing that, we should update the golden output to
reflect what all filesystems are supposed to be doing.
Curiously, the file checksums always match, and it's not *forbidden* for
the page cache to have a page backing an unwritten extent that hasn't
been written.
The condition that this test cares about is that block 3 (192k-256k) are
reported by SEEK_DATA as data even if the data fork has a hole and the
COW fork has an unwritten extent. Matthew Wilcox thinks this is a side
effect of readahead.
To fix this occasional false failure, call SEEK_DATA and SEEK_HOLE only
on the offsets that we care about.
Suggested-by: Matthew Wilcox <willy@infradead.org> 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, 16 Mar 2022 03:30:09 +0000 (20:30 -0700)]
generic/459: ensure that the lvm devices have been created
Once in a /very/ long while this test fails because _mkfs_dev can't find
the LVM thinp volume after it's been created. Since the "solution" du
jour seems to be to sprinkle udevadm settle calls everywhere, do that
here in the hopes that will fix it.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Filipe Manana [Thu, 3 Mar 2022 11:36:42 +0000 (11:36 +0000)]
generic: read multiple extents with io_uring
Test doing a read, with io_uring, over a file range that includes
multiple extents. The read operation triggers page faults when
accessing all pages of the read buffer except for the pages
corresponding to the first extent. We want to check that the
operation results in reading all the extents and that it returns the
correct data.
This is motivated by an issue found with MariaDB when using io_uring
and running on btrfs. There's a patch for btrfs to address the issue
ca93e44bfb5f ("btrfs: fallback to blocking mode when doing async dio
over multiple extents")
Masayoshi Mizuma [Wed, 16 Feb 2022 14:55:20 +0000 (09:55 -0500)]
xfs: test xfsdump with bind-mounted filesystem
commit 25195eb ("xfsdump: handle bind mount target") introduced
a bug of xfsdump which doesn't store the files to the dump file
correctly when the root inode number is changed.
The commit 25195eb is reverted, and commit 0717c1c ("xfsdump: intercept
bind mount targets") which is in xfsdump v3.1.10 fixes the bug to reject
the filesystem if it's bind-mounted.
Test that xfsdump can reject the bind-mounted filesystem.
Ojaswin Mujoo [Tue, 22 Feb 2022 17:50:53 +0000 (23:20 +0530)]
ext4: Test to ensure resize with sparse_super2 is handled correctly
Kernel currently doesn't support resize of EXT4 mounted with
sparse_super2 option enabled. Earlier, it used to leave the resize
incomplete and the fs would be left in an inconsistent state,
however commit b1489186cc83[1] fixed this to avoid the fs corruption
by clearly returning -EOPNOTSUPP.
Test to ensure that kernel handles resizing with sparse_super2
correctly. Run resize for multiple iterations because this sometimes
leads to kernel crash due to fs corruption, which we want to detect.
Ojaswin Mujoo [Tue, 22 Feb 2022 17:50:52 +0000 (23:20 +0530)]
src/ext4_resize.c: Refactor code and ensure accurate errno is returned
The current implementation of ext4_resize returned 1 whenever
there was an error. Modify this to return the correct error code.
This is important for tests that rely on correct error reporting, by
the kernel, for ext4 resize functionality.
Andrey Albershteyn [Mon, 21 Mar 2022 09:19:21 +0000 (10:19 +0100)]
README: restructure & format building manual
The commands for package managers for both Ubuntu and RHEL weren't
up-to-date. A few packages doesn't exist anymore or missing from the
latest repositories (e.g. liburing-devel, btrfs-progs-devel).
Ubuntu's list missed a few packages listed in RHEL's list. There are
a few repeating steps. The indent of avaliable environment variables
is not clear.
This patch:
- Update package dependencies for Ubuntu/Debian/RHEL/CentOS/Fedora
- Unify list of packages between Ubuntu/Debian and RHEL/CentOS/Fedora
- Add list of tool packages for other FS
- Add links to tools not in the standard repository for RHEL/CentOS
- Drop xfsprogs-qa-devel reference for old systems
- Replace note about EPEL with installation step with link to Fedora
manual
- Add configuration examples in 'Setup Environment'
- Small clarification details, such as size of the partition and
KCONFIG_PATH description
- Removal of repeating steps (install administrative tools,
partitions content)
- Restructuring and formatting of "BUILDING THE FSQA SUITE" section
- Drop IRIXDEV references in variable set up
- Variables in 'Additional setup' divided into groups
- Move fsqa user/group creation and udf_test to 'Setup Environment'
section
Shin'ichiro Kawasaki [Tue, 22 Feb 2022 04:19:08 +0000 (13:19 +0900)]
common/rc: avoid mixed mode for zoned btrfs
When the helper function _scratch_mkfs_sized is called with small
filesystem size and FSTYP=btrfs, it calls mkfs.btrfs with --mixed option
to enable mixed mode. However, mkfs.btrfs with --mixed option fails for
zoned block devices since btrfs does not support mixed mode together
with zoned mode. To avoid this failure, do not set --mixed option when
the scratch device is a zoned block device.
Filipe Manana [Thu, 3 Mar 2022 11:40:21 +0000 (11:40 +0000)]
generic: move test case btrfs/261 into the generic group
The test case btrfs/261, part from its comments, doesn't really exercise
any behaviour that is btrfs specific, so, as Dave Chinner pointed out, it
can be moved into the generic group.
This change moves that test into the generic group and slightly adjust the
comments to make it clear which parts are btrfs specific.
Sidong Yang [Wed, 2 Mar 2022 14:05:48 +0000 (14:05 +0000)]
btrfs: add test for enable/disable quota and create/destroy qgroup repeatedly
Test enable/disable quota and create/destroy qgroup repeatedly in
parallel and confirm it does not cause kernel hang. It only happens
in kernel staring with kernel 5.17-rc3. This is a regression test
for the problem reported to linux-btrfs list [1].
The hang was recreated using the test case and fixed by kernel patch
titled
btrfs: qgroup: fix deadlock between rescan worker and remove qgroup
Nitesh Shetty [Tue, 1 Mar 2022 21:29:47 +0000 (02:59 +0530)]
generic/108: use sysfs values for logical,physical block size in scsi_debug
scsi_debug device used for test, is created with assumption of 512
bytes logical and physical block size.
This causes error in lvcreate step, when SCRATCH_DEV device lba is
not 512 bytes. This can be solved by reading block size from sysfs
of device. If sysfs is missing fallback to 512 bytes as default.
Jan Kara [Tue, 22 Feb 2022 10:36:58 +0000 (11:36 +0100)]
generic: Add test for seekdir
Add test checking functionality of seekdir. We check whether seekdir
gets us back to the directory entry it should and also whether
seeking to random positions does not crash the filesystem.
Unlike test generic/310 which also tests seeking, this test checks both
glibc readdir() function as well as getdents64() syscall directly. This
is because glibc readdir() implementation does a lot of caching and
processing internally thus hiding kernel from some possible problems.
Also test wider range of random offsets to have better chance of
hitting out of bound accesses or other bugs.
This is a regression test for a48fc69fe658 ("udf: Fix crash after
seekdir")
Signed-off-by: Jan Kara <jack@suse.cz> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Anthony Iliopoulos [Wed, 16 Feb 2022 19:03:34 +0000 (20:03 +0100)]
btrfs: add support for capturing metadumps of corrupted fses
Add the capability to capture btrfs metadumps when filesystem checks
fail, so that they can be used for further debugging. This is useful
for tests that _require_test and/or _require_scratch for which
filesystem checkers will run after a test completes and may
occasionally pick up inconsistencies.
Filipe Manana [Thu, 17 Feb 2022 12:14:21 +0000 (12:14 +0000)]
btrfs: log replay after fsync of file with prealloc extents beyond eof
Test that after a full fsync of a file with preallocated extents
beyond the file's size, if a power failure happens, the preallocated
extents still exist after we mount the filesystem.
This test currently fails and there is a patch for btrfs that fixes
this issue and has the following subject:
"btrfs: fix lost prealloc extents beyond eof after full fsync"
Shin'ichiro Kawasaki [Fri, 18 Feb 2022 07:31:56 +0000 (16:31 +0900)]
common: factor out xfs unique part from _filter_mkfs
Most of the code in the function _filter_mkfs is xfs unique. This is
misleading that the function would be dedicated for xfs. Clean up the
function by factoring out xfs unique part to _xfs_filter_mkfs in
common/xfs. While at the same time, fix indent in _xfs_filter_mkfs to be
consistent with other functions in common/xfs.
Suggested-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Shin'ichiro Kawasaki [Fri, 18 Feb 2022 07:31:55 +0000 (16:31 +0900)]
xfs/015: check _scratch_mkfs_sized return code
The test cases xfs/015 calls _scratch_mkfs before _scratch_mkfs_sized,
and does not check return code of _scratch_mkfs_sized. Even if
_scratch_mkfs_sized failed, _scratch_mount after it cannot detect the
sized mkfs failure because _scratch_mkfs already created a file system
on the device. This results in unexpected test condition.
To avoid the unexpected test condition, check return code of
_scratch_mkfs_sized.
Suggested-by: Naohiro Aota <naohiro.aota@wdc.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Shin'ichiro Kawasaki [Fri, 18 Feb 2022 07:31:54 +0000 (16:31 +0900)]
ext4/021: check _scratch_mkfs_sized return code
The test cases ext4/021 calls _scratch_mkfs before _scratch_mkfs_sized,
and does not check return code of _scratch_mkfs_sized. Even if
_scratch_mkfs_sized failed, _scratch_mount after it cannot detect the
sized mkfs failure because _scratch_mkfs already created a file system
on the device. This results in unexpected test condition.
To avoid the unexpected test condition, check return code of
_scratch_mkfs_sized.
Suggested-by: Naohiro Aota <naohiro.aota@wdc.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
The test cases generic/{171,172,173,174} call _scratch_mkfs before
_scratch_mkfs_sized, and they do not check return code of
_scratch_mkfs_sized. Even if _scratch_mkfs_sized failed, _scratch_mount
after it cannot detect the sized mkfs failure because _scratch_mkfs
already created a file system on the device. This results in unexpected
test condition of the test cases.
To avoid the unexpected test condition, check return code of
_scratch_mkfs_sized in the test cases.
Suggested-by: Naohiro Aota <naohiro.aota@wdc.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
The test case generic/204 calls _scratch_mkfs to get data block size and
i-node size of the filesystem and obtained data block size is passed to
the following _scratch_mfks_sized call as an option. However, the
_scratch_mkfs call is unnecessary since the sizes can be obtained by
_scratch_mkfs_sized call without the data block size option.
Also the _scratch_mkfs call is harmful when the _scratch_mkfs succeeds
and the _scratch_mkfs_sized fails. In this case, the _scratch_mkfs
leaves valid working filesystem on scratch device then following mount
and IO operations can not detect the failure of _scratch_mkfs_sized.
This results in the test case run with unexpected test condition.
Hence, remove the _scratch_mkfs call and the data block size option for
_scratch_mkfs_sized call.
Suggested-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Luis Chamberlain [Tue, 15 Feb 2022 01:48:43 +0000 (17:48 -0800)]
btrfs/237: adjust uuid heuristics
Using $(findmnt -n -o UUID mount-directory) only works on
util-linux v2.38, not on 2.37. Even debian-testing has util-linux
v2.37, so use a mechanism which has worked for longer to fetch the
UUID.
Without this the test fails on permission failure on accessing
the file /sys/fs/btrfs/"$uuid"/bg_reclaim_threshold as $uuid is
empty. So while at it, add a check to ensure the UUID is never
empty.
Use $AWK_PROG in case the preferred awk program is not the
preferred awk program.
Cc: Karel Zak <kzak@redhat.com> Cc: Pankaj Raghav <p.raghav@samsung.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Tested-by: Adam Manzanares <a.manzanares@samsung.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Luis Chamberlain [Tue, 8 Feb 2022 21:37:54 +0000 (13:37 -0800)]
common/config: fix use of MODPROBE_RM_PATIENT_TIMEOUT_ARGS
When patient module removal support is detected on kmod
(note that this is not yet even merged onto kmod yet but
work in progress) the arguments required for it are not being
set yet. This was a typo, fix this.
This issue was spotted using shellcheck from blktests when adding
patient module removal support there. I'll post a patch next to
let folks evaluate if we should embrace shellcheck on fstests as
well.
Sun Ke [Tue, 8 Feb 2022 07:16:24 +0000 (15:16 +0800)]
common/attr: adbjust acl_max of f2fs
f2fs has set inline_xattr as a default option, and introduced a new
option named 'noinline_xattr' for disabling default inline_xattr
option. So in _acl_get_max we need to check 'noinline_xattr' string
in fs option, otherwise we may select the wrong max acl number since
we always found the string 'inline_xattr' in fs option.
Additionally, f2fs has changed disk layout of xattr block a bit, so
will contain one more entry in both inline and noinline xattr inode,
this patch will modify the max acl number to adjust it.
Suggested-by: Chao Yu <chao@kernel.org> Signed-off-by: Sun Ke <sunke32@huawei.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Qu Wenruo [Wed, 2 Feb 2022 04:29:29 +0000 (12:29 +0800)]
src/fssum: use newer EVP_* interface to replace deprecated MD5_* interace
In OpenSSL 3.0, MD_Init/Update/Final() interfaces are marked
deprecated, and we have to go EVP_DigestInit/Update/Final() instead.
Personally I'm not a fan of this, especially the new EVP_MD_CTX
structure can no longer be stack allocated, thus we have to
dynamically allocate and free EVP_MD_CTX in sum_init() and sum_free().
Hopes this is proper way to go and would solve the problem until
OpenSSL chooses to change their interface again.