David Howells [Mon, 10 Apr 2017 13:32:52 +0000 (14:32 +0100)]
generic: Add first statx test
Add a statx test script that does the following:
(1) Creates one each of the various types of file object and creates a
hard link to the regular file.
Note that the creation of an AF_UNIX socket is done with netcat in a
bash coprocessing thread. This might be best done with another
in-house helper to avoid a dependency on nc.
(2) Invokes the C test program included in this patch after the creation
and hands it a list of things to check appropriate to each object.
(3) Asks the test program to check the creation time of each object
against that of the preceding object.
(4) Makes various tests on the timestamps of the hardlinked file.
The patch also creates a C[*] test program to do the actual stat checking.
The test program then does the following:
(1) Compares the output of statx() to that of fstatat().
(2) Optionally compares the timestamps to see that they're sensibly
ordered with respect to each other.
(3) Optionally compares the timestamps to those of a reference file.
(4) Optionally compares the timestamps to a specified time.
(5) Optionally compares selected stats to values specified on the command
line.
(6) Optionally compares all the stats to those of a reference file,
requiring them to be the same (hard link checking).
The test program can also be given a --check-statx parameter to give a
quick exit code-based answer on whether statx() exists within the kernel.
[*] Note that it proved much easier to do this in C than trying to do it in
shell script and trying parsing the output of xfs_io. Using xfs_io has
other pitfalls also: it wants to *open* the file, even if the file is
not an appropriate type for this or does not grant permission to do so.
I can get around this by opening O_PATH, but then xfs_io fails to
handle XFS files because it wants to issue ioctls on every fd it opens.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
The filesystem was renamed OrangeFS from PVFS2 recently. The mount
-t type remains pvfs2, so I have used that name throughout despite
the kernel module being named orangefs.
We've been maintaining this as a patch for quite some time.
The easiest way to use is to setup a single server installation with
multiple filesystems orangefs and scratch, put the following in
/etc/xfsqa.config, and run ./check -pvfs2 -g quick.
Amir Goldstein [Fri, 7 Apr 2017 09:15:39 +0000 (12:15 +0300)]
src/t_immutable: add ftruncate to append only tests
The truncate and ftruncate syscalls check the IS_APPEND() flag
in 2 different vfs code paths and I had to fix both in order to
fix overlayfs IS_APPEND() violations.
Add the ftruncate test to t_immutable, so overlay/030 can verify
the fix.
Amir Goldstein [Thu, 6 Apr 2017 05:49:20 +0000 (08:49 +0300)]
overlay: test immutable and append-only upper files
Run the t_immutable test program for immutable/append-only files
and directories in an overlayfs upper directory.
This test is similar and was derived from generic/079, but
the original test is _notrun on overlay mount because FS_IOC_GETFLAGS
FS_IOC_SETFLAGS ioctls fail on overlay directory inodes.
Filipe Manana [Tue, 4 Apr 2017 06:34:30 +0000 (07:34 +0100)]
generic: test for number of bytes used by files after buffered writes
Test that a filesystem's implementation of the stat(2) system call
reports correct values for the number of blocks allocated for a file
when there are delayed allocations.
This test is motivated by a bug in btrfs which is fixed by the
following path for the linux kernel:
Filipe Manana [Tue, 4 Apr 2017 06:34:29 +0000 (07:34 +0100)]
common/rc: check fs supports xfs_io falloc's specific flags
For example NFS 4.2 supports fallocate but it does not support its
KEEP_SIZE flag, so we want to skip tests that use fallocate with
that flag on filesystems that don't support it.
Eric Biggers [Fri, 31 Mar 2017 19:48:36 +0000 (12:48 -0700)]
generic: test encryption key revocation during concurrent I/O
Add a test which revokes a keyring key while other processes are
performing I/O on an encrypted file that was "unlocked" using that key.
The crashes unpatched kernels with filesystem encryption enabled.
This bug was present in kernels v4.2 and later. It has been fixed in
v4.11-rc4, v4.10.7, v4.9.20, and v4.4.59.
Cc: Theodore Ts'o <tytso@mit.edu> Cc: Jaegeuk Kim <jaegeuk@kernel.org> Cc: Richard Weinberger <richard@nod.at> Cc: Michael Halcrow <mhalcrow@google.com> Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
David Sterba [Thu, 30 Mar 2017 15:20:18 +0000 (17:20 +0200)]
btrfs: reorder arguments so that options come first
The option parser in the btrfs utility is going to be updated and
will accept arguments in a stricter form, namely that options must
come before their non-option argument. Otherwise eg. the -f option
in send would be understood as another path and not an option
leading to many test failures.
Zorro Lang [Tue, 28 Mar 2017 08:46:35 +0000 (16:46 +0800)]
xfs/068: update golden output due to new operations in fsstress
xfs/068 use a fixed seed (-s) and number of operations (-n) to run
fsstress, to get fixed number of files and directories. But new
operations of fsstress will break this "fixed number". So update
it, after fsstress get new operations.
Zorro Lang [Tue, 28 Mar 2017 08:46:34 +0000 (16:46 +0800)]
fsstress: add mwrite/mread into test operation list
mmap is a popular and basic operation, most of softwares use it to
access files. More and more customers report bugs related with
mmap/munmap and other stress conditions.
So add mmap read/write test into fsstress to increase mmap related
stress to reproduce or find more bugs easily.
Zorro Lang [Wed, 22 Mar 2017 06:46:28 +0000 (14:46 +0800)]
common/rc: support gluster volume start with a slash
The format of glusterfs' TEST_DEV or SCRATCH_DEV is XXX:XXX or
XXX:/XXX, but xfstests can't accept the latter now. So change
the regular expression from "\w:\w" to ":/?", to accept more
glusterfs device format.
Eric Biggers [Tue, 21 Mar 2017 21:14:32 +0000 (14:14 -0700)]
generic: test renaming encrypted files without key
Add a new test to test another behavior when accessing encrypted
files without the key: renames should be forbidden, even though they
may be possible cryptographically. Test both a regular rename and a
cross rename. (It happens that generic/398 also covers the cross
rename case, but it's primarily for a different reason.)
Cc: Theodore Ts'o <tytso@mit.edu> Cc: Jaegeuk Kim <jaegeuk@kernel.org> Cc: Richard Weinberger <richard@nod.at> Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Eryu Guan [Fri, 10 Mar 2017 09:27:38 +0000 (17:27 +0800)]
generic: test pagecache invalidation after direct write
Test if direct write invalidates pagecache correctly, so that
subsequent buffer read reads the correct data from disk.
This test is inspired by LTP tests dio29, and serves as a regression
test for the bug found by it, see kernel commit c771c14baa33
("iomap: invalidate page caches should be after iomap_dio_complete()
in direct write").
The test can be easily expanded to other write/read combinations,
e.g. buffer write + direct read and direct write + direct read, so
they are also being tested.
Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Zorro Lang [Thu, 16 Mar 2017 05:28:19 +0000 (13:28 +0800)]
fstests: add GlusterFS support
Add basic GlusterFS support. Neither new GlusterFS specific tests
nor related patches are included. Only support FSTYP=glusterfs or
check -glusterfs XXX.
To test on glusterfs, two gluster volumes and two mountpoint
directories are needed.
Harish [Thu, 16 Mar 2017 10:31:25 +0000 (16:01 +0530)]
common/dmthin: Fix grep command for finding exact value
Sometimes there are multiple occurances of meta_name, pool_name,
data_name in dmsetup command which causes failures while adding in
next line. This patch greps for names at start of line.
If we create and delete files within the qgroup limits, qg->reserved
(allocations before commits) over-inflates and causes -EDQUOT to be
returned pre-maturely.
Also, 32/64bit data-type exchanges can cause reserved (u64) to go
negative (very large) and -EDQUOT is returned pre-maturely.
Will be fixed by patches with subjects:
btrfs: Retry after commit on getting EDQUOT
btrfs: Change qgroup_meta_rsv to 64bit
Eric Biggers [Tue, 14 Mar 2017 17:55:46 +0000 (10:55 -0700)]
common/config: don't hard-code SELinux context
If SELinux is enabled, by default xfstests mounts its filesystems
with "-o context=system_u:object_r:nfs_t:s0" so that no SELinux
xattrs get created and interfere with tests. However, this
particular context is not guaranteed to be available because the
context names are a detail of the SELinux policy. The SELinux
policy on Android systems, for example, does not have a context with
this name.
To fix this without having to manually override
SELINUX_MOUNT_OPTIONS, just grab the SELinux context of the root
directory. This is arbitrary, but it should always provide a valid
context. And if for some reason someone is actually running
xfstests in a specific SELinux context that needs files labeled with
a particular context, then they may still override
SELINUX_MOUNT_OPTIONS.
SELINUX_MOUNT_OPTIONS is already set in common/config. Setting it again
in common/quota is not necessary. Nor is SELINUX_MOUNT_OPTIONS specific
to quota tests, so common/quota is not the right place for it.
With this change, there is no longer a need to check the case of
$TEST_DEV being a substring of $TEST_DIR, because that would mean
that $TEST_DIR is a prefix of $TEST_DIR and that is not possible.
Eryu Guan [Fri, 10 Mar 2017 04:26:34 +0000 (12:26 +0800)]
common/rc: use findmnt to check mounted device
Doing 'grep -F "$dev on "' to find the mounted device is not
always accurate, e.g.
SCRATCH_DEV=/vda6 is mounted but not on SCRATCH_MNT=/vda6/ovl-mnt - aborting
Already mounted result:
/dev/vda6 on /vda6 type xfs (rw,relatime,context=system_u:object_r:nfs_t:s0,attr2,inode64,noquota)
Fix it by using findmnt command and specifying the $dev as mount
source, print the result in "$dev $mnt" format. This works for local
filesystems, network filesystems and overlayfs, avoids all kinds of
tricky and error-prone grep pattern/regex.
Also fixed the if-then-fi format in _check_mounted_on() while we're
at it.
Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Zorro Lang [Thu, 9 Mar 2017 16:40:19 +0000 (00:40 +0800)]
xfs/078: instead file image by mkfs on loopback device
If test on 4k sector size device, xfs/078 will fail when it try to
make a filesystem image with block size less than 4096. But if we
attach the file image to a loop device, it can accept 512 block
size. So this patch attach a loop device before do mkfs.xfs.
[eguan: replace bare mount/umount with [U]MOUNT_PROG]
Eric Sandeen [Fri, 10 Mar 2017 03:57:11 +0000 (11:57 +0800)]
generic: test orphan inode recovery on RO mount
There's a bug in xfs where the orphan inode list
is not processed on a readonly mount, and is still not
processed even if it gets mounted rw. This test exercises
that, and makes sure that the unlinked list is empty after
a transition to rw and an unmount.
While we're at it, sanity check the same thing for pure ro
and rw unmounts.
Now that shutdown is generic, we can test other filesystems
as well, so this is in the generic group.
Eryu Guan [Mon, 6 Mar 2017 11:45:57 +0000 (19:45 +0800)]
generic: require journal in shutdown tests
Tests in shutdown group are supposed to test journal recovery after
filesystem shutdown, and the tests assume the filesystem in test has
journal support. But with the ext4 shutdown function added in
4.11-rc kernel, ext2 gains shutdown support too when driving with
ext4 driver, so generic/051 fails because fs corruption after test.
Adding _require_metadata_journaling to all generic tests in shutdown
group to ensure there's journal present.
generic/050 is skipped because it has _require_scratch_nocheck,
which indicates no fsck is done after test.
Qu Wenruo [Wed, 8 Mar 2017 02:20:40 +0000 (10:20 +0800)]
generic: Test space allocation when there is only fragmented space
This test case will test if file system works well when handling
large write while available space are all fragmented.
This can expose a bug in a btrfs unmerged patch, which wrongly
modified the delayed allocation code, to exit before allocating all
space, and cause hang when unmounting.
The wrong patch is:
[PATCH v6 1/2] btrfs: Fix metadata underflow caused by btrfs_reloc_clone_csum error
The test case will:
1) Fill small filesystem with page sized small files
All these files has a sequential number as file name
2) Remove files with odd number as file name
This will free almost half of the space
3) Try to write a file which takes 1/8 of the file system
The method to create fragmented fs may not be generic enough, but
should work for most extent based fs. Unless one file system will
allocate extents from both end of its free space.
Cc: Filipe Manana <fdmanana@kernel.org> Cc: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Dmitry Monakhov [Fri, 3 Mar 2017 08:26:16 +0000 (12:26 +0400)]
report: Add xunit format report generator
xunit[1]/junit[2] are well known report formats for tests frameworks
which supported by most of test CI frameworks(such as Jenkins [3],
Bamboo [4], Avocado [5]) Basically this is just xml document which
can be easily parsed later by external tools.
Dmitry Monakhov [Fri, 3 Mar 2017 08:26:15 +0000 (12:26 +0400)]
check: prepare test report generator infrastructure
Save testcase data which later may be used by report generators
- Save failure reason to $err_msg variable
- Save number of notrun tests to $n_notrun counter, similar to
$n_try,$n_bad
Zorro Lang [Tue, 7 Mar 2017 08:55:12 +0000 (16:55 +0800)]
generic/409-411: remove all after unbind mountpoints
After some shared subtrees test (bind/slave/shared/private), maybe
some dentries isn't freed. For example, EBUSY maybe returned due to
some bugs. This patch tries to verify that.
Signed-off-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Gwendal Grignou [Mon, 6 Mar 2017 22:14:16 +0000 (14:14 -0800)]
common/config: make SELinux protection conditional
When selinux utilities are present, xfstests add options to help
circumvent selinux protection. However, on Chrome OS, it leads to
the opposite effect, when it prevents mount to succeed.
BUG=chromium:669641
TEST=xfstest test ext4/001 completes where it use to display:
common/rc: could not mount /dev/loop29 on /usr/local/autotest/tmp/xfstests_TEST
Amir Goldstein [Tue, 28 Feb 2017 12:18:37 +0000 (14:18 +0200)]
overlay: use OVL_BASE_SCRATCH_MNT instead of SCRATCH_DEV
Use the new var OVL_BASE_SCRATCH_MNT to refer to overlay
base dir instead of the legacy SCRATCH_DEV var.
In overlay/011, when using MOUNT_PROG directly, provide
OVL_BASE_SCRATCH_MNT as device argument instead of 'none'.
This fix is required to support mount of base fs.
Amir Goldstein [Tue, 28 Feb 2017 12:18:36 +0000 (14:18 +0200)]
overlay: mount/unmount base fs before/after running tests
When TEST/SCRATCH_DEV are configured to the base fs block device,
use this information to mount base fs before running tests,
unmount it after running tests and cycle on _test_cycle_mount
along with the overlay mounts.
This helps catching overlayfs bugs related to leaking objects in
underlying (base) fs.
To preserve expected tests behavior, the semantics are:
- _scratch_mkfs mounts the base fs, cleans all files, creates
lower/upper dirs and keeps base fs mounted
- _scratch_mount mounts base fs (if needed) and mounts overlay
- _scratch_unmount unmounts overlay and base fs
Tests that use _scratch_unmount to unmount a custom overlay mount
and expect to have access to overlay base dir, were fixed to use
explicit umount $SCRATCH_MNT instead.
The overlay test itself, does not support formatting the base fs,
so config options like MKFS_OPTIONS and FSCK_OPTIONS are ignored
on 'check -overlay'.
The config option MOUNT_OPTIONS is used to mount the base scratch fs.
The config option TEST_FS_MOUNT_OPTS is used to mount the base test fs.
The config option OVERLAY_MOUNT_OPTIONS is used to mount both test and
scratch overlay mounts.
Amir Goldstein [Tue, 28 Feb 2017 12:18:35 +0000 (14:18 +0200)]
overlay: configure TEST/SCRATCH vars to base fs
Instead of setting the vars TEST/SCRATCH_DEV to overlay base dirs,
allow setting them to block devices to configure the base fs partition,
where overlay dirs will be created.
For example, the following config file can be used to run tests on
xfs test/scratch partitions:
Using the same config file, but executing './check -overlay' will
use the same partitions as base fs for overlayfs directories
and set TEST_DIR/SCRATCH_MNT values to overlay mount points, i.e.:
/mnt/test/ovl-mnt and /mnt/scratch/ovl-mnt.
The base fs should be pre-formatted and mounted when starting the test.
An upcoming change is going to support mount/umount of base fs.
The new vars OVL_BASE_SCRATCH_MNT/TEST_DIR are set to point at the
overlayfs base dirs in either legacy or new config method.
Tests should always use these vars and not the legacy SCRATCH/TEST_DEV
vars when referring to overlay base dir.
Amir Goldstein [Tue, 28 Feb 2017 12:18:34 +0000 (14:18 +0200)]
overlay: rename OVERLAY_LOWER/UPPER/WORK_DIR
As preparation step for configuring test/scratch base fs
for overlay tests:
- Rename OVERLAY_LOWER/UPPER/WORK_DIR => OVL_LOWER/UPPER/WORK
because we want to use OVL_ prefix for all base fs vars
- Prepend "ovl-" prefix to lower/upper/work path values to
isolate the overlay test dirs when running on a base fs
that is also used to run non overlay tests
- Make those vars values non-configurable, because lower/upper/work
directory names are an internal test detail which should
not concern the user and because we wish to simplify
and document the overlay tests setup
- Add helper _filter_ovl_dirs and use it to filter output
of test overlay/023 which matches the constant string "work"
Amir Goldstein [Tue, 28 Feb 2017 12:18:33 +0000 (14:18 +0200)]
generic/064: access SCRATCH_MNT after _scratch_mount
Test is calling _get_block_size $SCRATCH_MNT before
_scratch_mount. This results in block size of the
wrong fs and a failure with overlay base fs setup.
Amir Goldstein [Tue, 28 Feb 2017 12:18:32 +0000 (14:18 +0200)]
fstests: allow overlay SCRATCH_DEV to be a base fs mount point
When configure SCRATCH_DEV to a mount point (and not to a directory therein)
then user will get a false positive error in scratch tests:
$SCRATCH_DEV=/mnt/base/scratch is mounted but not on $SCRATCH_MNT=/mnt/scratch
Already mounted result:
/dev/sda6 on /mnt/base/scratch type xfs (rw,relatime,attr2,inode64,noquota)
This is due to the wrong `grep -F $SCRATCH_DEV` which matches the mount
point instead of the device in that mount.
Fix _check_mounted_on() to grep the pattern "$dev on " and "$dev on $mnt"
instead of just grepping for "$dev" and "$mnt" without the " on " anchor.
Amir Goldstein [Tue, 28 Feb 2017 12:18:31 +0000 (14:18 +0200)]
fstests: fix test and scratch filters for overlapping DEV/MNT paths
When configuring overlay base fs, TEST_DEV/DIR and SCRATCH_DEV/MNT
are derived from the base fs mount points, where *_DEV are the
path of the base fs mount point and TEST_DIR/SCRATCH_MNT are
a directory under the base fs mount point.
This means that the overlay DEV paths are prefixes of the overlay
mount points.
Fix the test and sctach filters to check if TEST_DEV/SCRATCH_DEV is
a substring of TEST_DIR/SCRATCH_MNT and try and match the longer
string first.
Amir Goldstein [Tue, 28 Feb 2017 12:18:30 +0000 (14:18 +0200)]
fstests: canonicalize mount points on every config section
Create helper _canonicalize_mountpoint() to check and canonicalize
a mount point path.
Use helper to canonicalize TEST_DIR and SCRATCH_MNT after parse
of every config section.
Amir Goldstein [Tue, 28 Feb 2017 12:18:29 +0000 (14:18 +0200)]
fstests: use _test_mount() consistently
On start of every test run and on every test, in init_rc() helper,
the test partition is verified to be mounted, or is mounted by
the helper _test_mount().
_test_mount() uses mount options $TEST_FS_MOUNT_OPTS and not
$MOUNT_OPTIONS like _scratch_mount() does.
_test_cycle_mount(), which is called by some tests uses the
_test_mount() helper as well.
Contrary to those cases, in _require_test() helper, if test
partition is not mounted, the helper _mount_or_remount_rw()
is called to mount the test partition with $MOUNT_OPTIONS.
Although this should never happen, because of the test in
init_rc(), this case is inconsistent with the rest of the code,
so it has been changed to use _test_mount() as it should.
When running tests with a multi section configuration, and
either FSTYP or MOUNT_OPTIONS change between sections, the
helper _test_unmount() is called to unmount the old test mount
and then _mount_or_remount_rw() is called to mount it again
with new FSTYP and/or MOUNT_OPTIONS.
This is again inconsistent with the rest of the code, so
was changed to use _test_mount() and instead of checking
if MOUNT_OPTIONS have changed between sections, we check if
TEST_FS_MOUNT_OPTS were changed between sections.
Otherwise, we can leave the test partition mounted.
This change is needed to support overlay base fs mount
and for multi section config files which include overlay FSTYP.
Amir Goldstein [Tue, 28 Feb 2017 12:18:28 +0000 (14:18 +0200)]
fstests: sanity check that test partitions are not mounted elsewhere
When $TEST_DEV is mounted at a different location then $TEST_DIR,
_require_test() aborts the test with an error:
TEST_DEV=/dev/sda5 is mounted but not on TEST_DIR=/mnt/test
There are several problems with current sanity check:
1. the output of the error is mixed into out.bad and hard to see
2. the test partition is unmounted at the end of the test regardless
of the fact that it not pass the sanity that we have exclusivity
3. scratch partition has a similar sanity check in _require_scratch(),
but we may not get to it, because $SCRATCH_DEV is unmounted prior
to running the tests (which could unmount another mount point).
To solve all these problems, introduce a helper _check_mounted_on().
It checks if a device is mounted on a given mount point and optionally
checks the mounted fs type.
The sanity checks in _require_scratch() and _require_test() are
converted to use the helper and gain the check for correct fs type.
The helper is used in init_rc() to sanity check both test and scratch
partitions, before tests are run and before $SCRATCH_DEV is unmounted.
Eric Biggers [Tue, 28 Feb 2017 22:09:36 +0000 (14:09 -0800)]
common/rc: accept "localdomain" to mean YP/NIS disabled
When asked to 'cat' the passwd or group files, currently xfstests runs
the 'domainname' program to get what the kernel thinks the domainname
is. It seems that traditionally this has been "(none)" if YP/NIS is not
in use. However, Android devices use a different convention which is to
set the domainname to "localdomain". Therefore, this patch updates
xfstests to accept both conventions to indicate YP/NIS disabled. This
stops a number of tests from failing when run on Android.
Darrick J. Wong [Sat, 25 Feb 2017 01:12:57 +0000 (17:12 -0800)]
reflink: test adjacency of reflinked blocks
If we reflink a file with N blocks to another file one block at a time,
does the destination file end up with the same number of extents as the
source file? In other words, does the filesystem succeed at combining
adjacent mappings into a maximal extents?
Signed-off-by: Darrick J. Wong <djwong@djwong.org> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Zorro Lang [Mon, 27 Feb 2017 08:23:03 +0000 (16:23 +0800)]
common/xfs: fix unexpected failure on real 4k sector device
_xfs_mkfs_validation_check() run "$cmd -s size=2s" to be sure if
xfsprogs support stricter input checks. But there's an unexpected
failure on 4k sector device:
Xiong Zhou [Thu, 23 Feb 2017 09:42:43 +0000 (17:42 +0800)]
overlay: filter out xattr starts with "trusted.overlay."
Overlayfs should only filter out xattr starting with
"trusted.overlay.", not "trusted.overlay".
Setting xattrs like "trusted.overlay.xxx" is not allowed.
Setting xattrs like "trusted.overlayxxx" is allowed.
v4.8-rc1 introduced a regression that we can't set xattrs
like "trusted.overlayxxx". Kernel commit below fixed it
in v4.8: fe2b75952347 ovl: Fix OVL_XATTR_PREFIX
This case tests both get/set of these 2 kinds of xattrs.
Pattern "trusted.overlay.xxx" should fail, however the
errno returned by set/get varies among kernel versions.
Zorro Lang [Thu, 23 Feb 2017 03:08:21 +0000 (11:08 +0800)]
generic/095: fix duplicate variable name
I think this definitely isn't what we want:
local warn4="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_aio_read.*"
local warn4="WARNING:.*fs/iomap\.c:.*iomap_dio_rw.*"
The second warn4 will override the first one. So change the second
to warn5.
Signed-off-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Xiao Yang [Thu, 23 Feb 2017 03:35:30 +0000 (11:35 +0800)]
xfs/133,4: make sure xfs_db sets negative i_size
1) xfs/133 and xfs/134 work abnornamlly on RHEL6.8GA and RHEL6.9Beta
because xfs_db fails to set negative i_size and reports "usage:
write fieldname value". The special argument "--" is only used to
end option-scanning in getopt(). So we can run two xfs_db commands
to set negative i_size regardless of the special argument "--" is
needed or not. getopt() has been produced by 'commit c9f5e3db22098
("xfs_db: Allow writes of corrupted data")'.
2) xfs/134 passes unexpectedly on RHEL6.8GA due to EINVAL, so we use
touch command to create 512-aligned test file.
Xiao Yang [Wed, 22 Feb 2017 08:17:03 +0000 (16:17 +0800)]
shared/005,7: fix making sure debugfs sets negative i_size
If the kernel bug has been fixed, stat command fails to get i_size
and reports "Structure needs cleaning". So we use debugfs -R "stat"
instead of stat command to make sure debugfs sets negative i_size.
These cases have been broken by commit 0e13e40b247a1 ("shared/005,7:
make sure debugfs sets negative i_size").
Dmitry Monakhov [Wed, 22 Feb 2017 09:48:13 +0000 (13:48 +0400)]
check: fix incorrect interrupt detection
Currently "Interrupted!" string always appeared in check.log because
flag cleared at very end after summary was dumped already. It looks
very strange, but it was broken from very beginning 27fba05e
(2001-01-15)
- update interrupt flag at the end of a section loop, but before _wrapup
- dump 'Interrupted' to stdout
Xiong Zhou [Wed, 8 Feb 2017 04:11:17 +0000 (12:11 +0800)]
xfs: test per-inode DAX flag by IO
In a DAX mountpoint, do IO betwen files with and
without DAX per-inode flag. We do mmap, both
O_DIRECT and buffered read/write IO in this case.
Then test again in the same device without dax
mountoption.
Add help _require_scratch_dax to make sure we can
test DAX feature on SCRATCH_DEV.
Add mmap dio test programme to test read/write
between a mmap area of one file and another file
directly or buffered, with different size.
Filipe Manana [Tue, 14 Feb 2017 20:36:17 +0000 (20:36 +0000)]
generic: truncate after a mix of dio and buffered writes
Test that if we have a file with a hole, do a mix of direct IO and
buffered writes to it and truncate the file to a size that lies in
the middle of the hole, after unmounting and mounting again the
filesystem, the file has a correct size and no data loss happened.
This test is motivated by a bug found in btrfs when used with the
no-holes feature (i.e. MKFS_OPTIONS="-O no-holes") which is fixed by
the following patch for the linux kernel:
Btrfs: fix data loss after truncate when using the no-holes feature
Zorro Lang [Tue, 14 Feb 2017 00:55:45 +0000 (19:55 -0500)]
generic: test two vfsmount no peers
This test cover linux commit 7ae8fd0, when mnt_group_id=0, it means
this mount no peers. But this bug treat two zero mnt_group_id as
peers. And it cause a crash by dereference a NULL address.
As below, the crash will happen when mount fs on "B/mnt1/mnt2":
Zorro Lang [Tue, 14 Feb 2017 00:55:42 +0000 (19:55 -0500)]
common/rc: new functions for multi-level mount/umount operations
When I try to write cases about mount shared subtrees test, I find I
always need to do many mount operations, then then umount those
mount point one by one.
To make the code clear, I use a stack to save mounted points
sequentially, then I write 3 common functions to operate this stack.
1. The global stack named MOUNTED_POINT_STACK
2. _get_mount() accepts mount parameters like _mount() does, but the
mountpoint parameter must be the last one. It will run the
mount operation and push the mountpoint name into stack.
3. _put_mount() doesn't need any parameter. It will pop the newest
mountpoint name from the stack, and umount it.
4. _clear_mount_stack() doesn't need any parameter either. It will
umount all mountpoints in the stack sequentially, and set
MOUNTED_POINT_STACK=""
Generally, the _clear_mount_stack() function also can be used as
_init_mount_stack() at the beginning of a case. Because it will
prepare an empty stack.
This test is based on generic/033, which originally used zero range
operations to reproduce indlen reservation problems. Zero range now
includes a pagecache flush before it updates extents, which means
generic/033 is no longer able to reproduce the problem it was
originally written to test.
Create a new test that uses an XFS-specific mechanism (in DEBUG
mode) to induce delalloc extent splits and reproduce the problem
originally reproduced by generic/033. In addition, update the test
to include a larger buffered write pattern that is known to
reproduce premature indlen exhaustion on delalloc extents.
Xiao Yang [Mon, 13 Feb 2017 11:21:50 +0000 (19:21 +0800)]
shared/005,7: make sure debugfs sets negative i_size
shared/005 and shared/007 work abnornamlly on RHEL6.8GA and
RHEL6.9Beta because debugfs fails to set i_size to -1 or -512
and reports "exceeds field size maximum". When debugfs fails
to set a negative i_size, we can skip these cases which don't
trigger the kernel bug.
Xiao Yang [Tue, 7 Feb 2017 09:58:19 +0000 (17:58 +0800)]
common/fuzzy: discard xfs_io stdout in _scratch_fuzz_modify
xfs/083 fails because _scratch_fuzz_modify redirects xfs_io stdout
to $ROUND2_LOG. _scratch_fuzz_modify function has been modified by
commit 7a7463d362cd3 ("populate: fix some silly errors when
modifying a fs while fuzzing").
Anand Jain [Mon, 6 Feb 2017 07:55:39 +0000 (15:55 +0800)]
fstests: btrfs: Use compressible data
/dev/urandom is incompressible and, /dev/zero is highly compressible,
so both are less effective in testing the compress code logic in btrfs.
This patch introduces a text data generator
cat /dev/urandom | od
to populate the files where /dev/urandom is currently being used in the
btrfs test cases.
And updates the _populate_fs() with a new option -c, so to instruct
to use the compressible data to populate the file(s).
Theodore Ts'o [Sun, 5 Feb 2017 06:53:34 +0000 (01:53 -0500)]
generic: honor the FSSTRESS_AVOID environment variable
Make sure all tests which run fsstress, and which do not have a very
specific custom profile of which file system operations to run, honor
the FSSTRESS_AVOID environment variable.
Omer Zilberberg [Sun, 5 Feb 2017 06:58:20 +0000 (08:58 +0200)]
generic/074: _cleanup potentially removes local FS files
fstest_dir is set after _cleanup() is defined and _require_test is
called. If _require_test fails (due to some unrelated bug in tested
FS), _cleanup will attempt to remove $fstest_dir.*, which expands to
.* This has the unfortunate effect of removing xfstests' .git and
.gitignore.
Here is the 074.out.bad file for this case:
QA output created by 074
mount: permission denied
common/rc: retrying test device mount with external set
mount: permission denied
common/rc: could not mount /dev/pmem0 on /mnt
rm: refusing to remove '.' or '..' directory: skipping '.'
rm: refusing to remove '.' or '..' directory: skipping '..'
----
The only other test which could face the same problem is
generic/285. However, that test defines _cleanup after the
_require* calls, and so on _require_test failure, 285.out.bad
contains the harmless:
./common/rc: line 1: _cleanup: command not found
Theodore Ts'o [Fri, 3 Feb 2017 16:25:37 +0000 (11:25 -0500)]
generic/398: update errors to be returned when doing cross renames w/o keys
The bug fix that ultimately landed in the fscrypt tree will return
ENOKEY instead of EPERM when doing a cross rename involving a
directory where the key is not available. So fix up the golden output
for generic/398 accordingly.
Theodore Ts'o [Fri, 3 Feb 2017 20:50:37 +0000 (15:50 -0500)]
generic/388: use the src/godown program instead of xfs_io
The "xfs_io -xc shutdown $MNT" command doesn't work on non-xfs file
systems. So use the equivalent src/godown program instead, which is
how the other tests which use the shutdown command were converted from
xfs-specific tests to generic tests.
Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Amir Goldstein [Fri, 3 Feb 2017 11:05:37 +0000 (13:05 +0200)]
generic/007: cleanup $TEST_DIR/$seq dir
Test generic/007 was failing after running test overlay/007,
because the latter left behind a non empty directory named 007
in test dir and the former failed to mkdir a directory with the
same name.
Cleanup $TEST_DIR/$seq both at end of overlay/007 and beginning of
generic/007 to avoid this collision.
Darrick J. Wong [Sat, 28 Jan 2017 17:38:25 +0000 (09:38 -0800)]
xfs/030: ignore lost rmapbt blocks
When we destroy the AG0 headers, we also lose track of the rmapbt
blocks, which causes xfs_repair to complain about their unconnectedness.
Filter out the error message from the output.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>