xfstests-dev.git
6 years agogeneric/397: be compatible with ignored SIGPIPE
Eric Biggers [Mon, 12 Jun 2017 21:15:28 +0000 (14:15 -0700)]
generic/397: be compatible with ignored SIGPIPE

If generic/397 is executed in an environment with SIGPIPE ignored,
it fails because the 'yes' program prints an error message:

    yes: standard output: Broken pipe
    yes: write error

This can be reproduced with:

    trap '' SIGPIPE; ./check generic/397

Fix it by generating the string of 255 y's using just 'head' and
'tr' instead of 'yes', 'head', and 'tr'.

Although it's not really a good idea to execute xfstests with
SIGPIPE ignored, this is the only test I've noticed where it causes
a problem, so it might as well be fixed in the test.

It would be much nicer to prevent this problem for all tests by
making the 'check' script restore the default SIGPIPE handler.  But
that isn't straightforward because bash's 'trap' builtin doesn't
allow un-ignoring signals that were ignored on entry to the shell.

[ eguan added more background infomation to commit log, which is
  also from Eric.

I think it's an easy problem for others to run into, since sometimes
processes ignore SIGPIPE because they want to get write errors
instead, but then when doing fork() + exec() they forget to reset
the SIGPIPE handler. Notably, Python got this wrong and it wasn't
fixed until Python 3, so any programs executing the 'check' script
from a Python 2 script will usually get this wrong (see:
https://bugs.python.org/issue1652). And usually everything works
fine but every once in a while there is a weird problem like this
which has to be debugged. ]

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agobtrfs: incremental send after renaming a file and a directory
Filipe Manana [Tue, 13 Jun 2017 15:06:39 +0000 (16:06 +0100)]
btrfs: incremental send after renaming a file and a directory

Test that an incremental send works if we rename some directory inode A
and then rename some file inode B to the name inode A had, for the case
where the directory inode A is an ancestor of inode B in the parent
snapshot.

This issue is fixed by the following patch for the linux kernel:

  "Btrfs: incremental send, fix invalid path for unlink commands"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agocommon: UDF does not support journalling
Jan Kara [Wed, 14 Jun 2017 07:19:21 +0000 (09:19 +0200)]
common: UDF does not support journalling

UDF does not support journalling. Make the appropriate feature test fail
for it.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric/360: Create symlink with valid path
Jan Kara [Wed, 14 Jun 2017 07:19:20 +0000 (09:19 +0200)]
generic/360: Create symlink with valid path

A test is creating symlink with a path containing name 1023 characters
long. Such file name is invalid for most filesystems (the limit on file
name lenght is mostly 255 characters) and UDF actually complains about
this and so the test fails. Since the point of this test is to verify
storage of the symlink, change the test to use a valid path where each
component name has only 254 characters.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: test for buggy fscrypt context consistency check
Eric Biggers [Fri, 9 Jun 2017 22:36:33 +0000 (15:36 -0700)]
generic: test for buggy fscrypt context consistency check

Add a regression test for a bug where ->lookup() in an encrypted
directory would incorrectly return EPERM, depending on which inodes
happened to have their keys still cached in memory following removal of
the keyring key.  This bug was fixed in v4.12-rc1, v4.9.29, and v4.4.70.

Cc: linux-fscrypt@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agobtrfs: test incremental send after renaming and linking file
Filipe Manana [Wed, 7 Jun 2017 15:36:31 +0000 (16:36 +0100)]
btrfs: test incremental send after renaming and linking file

Test that an incremental send operation works correctly when an inode A
is renamed, a new hard link added to it and some other inode B is renamed
to the old name of inode A.

The btrfs bug is fixed by the following patch for the linux kernel:

  "Btrfs: send, fix invalid path after renaming and linking file"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agofstests: Fix block device requirements and manual scratch mounts
David Oberhollenzer [Wed, 7 Jun 2017 08:20:47 +0000 (10:20 +0200)]
fstests: Fix block device requirements and manual scratch mounts

Some tests require the scratch volume to be a block device,
although they don't do anything block device specific like
the device mapper tests. They actually only require a local
device and fail with network or overlay pseudo mount devices.

The same tests also try to mount the scratch device manually
after running _scratch_mkfs. For UBIFS, _scratch_mkfs simply
truncates the UBI volume and relies on the kernel to re-format
the volume on the next mount. This fails if the fs type is not
specified explicitly when mounting.

This patch replaces the block device requirement with a
generic check for a local device and adds a filesystem
specification to all manual mounts of the scratch device
to a mount point.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric/398: Accept failing with EPERM in addition to ENOKEY for rename without key
David Oberhollenzer [Wed, 7 Jun 2017 08:20:46 +0000 (10:20 +0200)]
generic/398: Accept failing with EPERM in addition to ENOKEY for rename without key

Some filesystems (e.g. UBIFS) fail with EPERM when trying to move a
file into an encrypted directory via cross rename, without having
access to the encryption key.

Since rename is perfectly allowed to return EPERM, which is also
tested for, and no precise specification seems to exist that
clarifies when to expect EPERM and when ENOKEY, this patch modifies
the generic/398 test to accept both, for the test case where the key
is not available.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agofstests: Add support for UBIFS
David Oberhollenzer [Wed, 7 Jun 2017 08:20:45 +0000 (10:20 +0200)]
fstests: Add support for UBIFS

UBIFS is a filesystem for unmanaged flash memory devices. It works
on top of UBI (Unsorted Block Images) which is a wear leveling and
volume management layer on top of flash memory devices, which are
handled by the MTD subsystem (memory technology device).

Since the semantics of flash devices are drastically different from
regular block devices (blocks or "pages" must be erased before
writing, only larger groups of pages or "erase blocks" can be erased
at once, page write must be in order within an erase block, etc...)
it was decided to expose MTD devices as character devices with
ioctls for operations like erase.

Since erasing a flash erase block causes physical wear on the
device, eventually causing the erase blocks to go bad, the UBI layer
provides mainly transparent wear leveling on top of MTD devices. UBI
does not attempt to emulate a regular block device, but rather
something like a flash memory with idealized characteristics that
can be partitioned into multiple UBI volumes in a fashion somewhat
similar to LVM. UBI volumes are also exposed to user space as
character devices.

This patch mainly deals with some quirks of UBIFS like working on
top of character devices instead of block devices. Also UBIFS
automatically formats UBI devices when trying to mount an empty
device. The mkfs.ubifs program is mainly used for creating images.
This patch changes _scratch_mkfs and _scratch_mkfs_encrypted to
truncate the UBI volume instead, relying on the kernel to reformat
it on the next mount.

For _scratch_mkfs_encrypted this is actually required to get the
encryption tests to run, because mkfs.ubifs, at the time of writing
this, the kernel support for UBIFS encryption is fairly recent and
mkfs.ubifs does not have proper support yet.

The necessity of an additional -ubifs switch was discussed but auto
detection of UBIFS formated UBI devices could not be reproduced on
my end and is unlikely to work with empty UBI volumes anyway.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agocommon/rc: Add tests for character devices
David Oberhollenzer [Wed, 7 Jun 2017 08:20:44 +0000 (10:20 +0200)]
common/rc: Add tests for character devices

Implement _is_char_dev similar to _is_block_dev to test for
character devices.

Add a _require_local_device test. This test is similar to
_require_block_device but checks if the path refers to a
block or a character device.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agobtrfs: test Btrfs delalloc accounting overflow
Omar Sandoval [Wed, 7 Jun 2017 06:57:10 +0000 (23:57 -0700)]
btrfs: test Btrfs delalloc accounting overflow

This is a regression test for patch "Btrfs: fix delalloc accounting
leak caused by u32 overflow". It creates a bunch of delalloc extents
and merges them together to make sure the accounting is done right.

[eguan: use $XFS_IO_PROG instead of xfs_io]

Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric/019: Silence possible kill failure
Nikolay Borisov [Tue, 6 Jun 2017 13:37:22 +0000 (16:37 +0300)]
generic/019: Silence possible kill failure

When the filesystem is force-killed in generic/019 and fsstress is
compiled with DEBUG then it's possible for check_cwd() to fail. In
this case fsstress would just die and invoking kill on its pid would
produce an error to the output file:

+./tests/generic/019: line 157: kill: (32750) - No such process

Fix this possibility by ignoring the result of the output command,
this won't affect the test coverage.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agocommon/rc: Fix wrong word in _require_group
Nikolay Borisov [Fri, 2 Jun 2017 14:50:46 +0000 (17:50 +0300)]
common/rc: Fix wrong word in _require_group

Make _require_group yield the correct error message when the
requested group is not found.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: hole punching followed by writes in the same range
Filipe Manana [Tue, 30 May 2017 04:52:50 +0000 (05:52 +0100)]
generic: hole punching followed by writes in the same range

Test that if we punch a hole in a file, with either a range that goes
beyond the file's size or covers a file range that is already a hole,
and that if after we do some buffered write operations that cover
different parts of the hole, no warnings are emmitted in syslog/dmesg
and the file's content is correct after remounting the filesystem.

This test is motivated by a bug in btrfs that is manifested in kernel
4.12-rc1 onwards (the bug existed long time ago but was not so easy
to expose before 4.12-rc1). The btrfs patch that fixes the issue is
titled: "Btrfs: fix invalid extent maps due to hole punching".

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agosrc/listxattr: Fix reading past the end of the user buffer
Nikolay Borisov [Tue, 30 May 2017 14:10:07 +0000 (17:10 +0300)]
src/listxattr: Fix reading past the end of the user buffer

listxattr reaturns a null-terminated list of entries that represent
the xattr names. However, if it is passed larger buffer than it
requires it won't zero-out the rest of the memory. The way the
loop iterator in listxattr.c is written makes it go print every
null-terminated entry up to bufsize (which is user passed parameter).
This can lead to a situation where listxattr users N bytes out of
M bytes big buffer ( M > N). This will leave the rest (M-N)
as garbage, which in turn will be printed by listxattr. Fix this
by converting the 'for' loop to 'while' and properly ensuring
we are reading at most howevermany elements the syscall reported
it returned

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agobuild: workaround build failures with old autoconf version
Eryu Guan [Tue, 16 May 2017 07:39:35 +0000 (15:39 +0800)]
build: workaround build failures with old autoconf version

Xiao Yang reported that fstests failed to build on RHEL6.9 hosts due
to old autoreconf didn't pass -I to aclocal -I. (This was fixed by
autoconf commit 44fbeef86d03 ("Pass autoreconf -I to aclocal -I"),
but not on RHEL6.9).

So call aclocal, autoheader and autoconf directly instead of
autoreconf, as what's done in xfsprogs Makefile.

Reported-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: Add regression test for tail page zeroing
Jan Kara [Mon, 29 May 2017 11:32:15 +0000 (13:32 +0200)]
generic: Add regression test for tail page zeroing

Add test checking for a race in ext4 writeback that could result in
zeroing too much from the tail page during writeback.

[eguan: removed from quick group, it needs longer time on xfs and
btrfs]

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agonfs: test nfs4_getfacl near page size ACL from server
Eryu Guan [Tue, 16 May 2017 11:35:15 +0000 (19:35 +0800)]
nfs: test nfs4_getfacl near page size ACL from server

Test nfs4_getfacl gets ACL list correctly from server when the ACL
length is close enough to the end of a page. On buggy NFS client
getxattr could return ERANGE. Upstream commit ed92d8c137b7 ("NFSv4:
fix getacl ERANGE for some ACL buffer sizes") fixed this bug in 4.11
kernel.

Note that this reproducer was originally written by J. Bruce Fields.

Cc: J. Bruce Fields <bfields@redhat.com>
Cc: Weston Andros Adamson <dros@primarydata.com>
Cc: linux-nfs@vger.kernel.org
Reviewed-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agobuild: Stop relying on OpenSSL
Theodore Ts'o [Thu, 25 May 2017 17:41:34 +0000 (13:41 -0400)]
build: Stop relying on OpenSSL

The OpenSSL dependency was added for one program, fssum, and it needs
it only because it needs a md5 implementation.  Use Solar Designer's
openssl compatible implementation of md5 so we no longer need to
depend on OpenSSL.

Since the OpenSSL libraries are not always available, we had to add
extra complexity to test to see whether fssum exists.

The other problem with depending on the OpenSSL libraries is that
shared library compatibility situation is terrible; a fssum binary
built on a system using libssl1.0.0 is *NOT* run on a system with
libssl1.0.2, since the shared libraries are incompatible even across a
minor version bump.  (Sigh.)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric/108: Fix return value check from _get_scsi_debug_dev
Nikolay Borisov [Thu, 25 May 2017 09:08:46 +0000 (12:08 +0300)]
generic/108: Fix return value check from _get_scsi_debug_dev

_get_scsi_debug_dev is supposed to return a "/dev/$device".
However, in case the scsi device is not mapped to a disk, hence
/dev/sd* doesn't exist, then get_scsi_debug_dev would return only
the "/dev/" string. In generic/108 we check whether return value is
"" and only then consider it a failure. This behavior allows the
test to erroneously consider _get_scsi_debug_dev succeeded even if
it returned a malformed string. Fix this by correctly checking
whether the return value is "/dev/"

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agoxfs/288: filter out extra mkfs warning
Zorro Lang [Thu, 25 May 2017 08:38:38 +0000 (16:38 +0800)]
xfs/288: filter out extra mkfs warning

From xfsprogs v4.7, mkfs.xfs add respecification detection by
commit 9090e18. Then mkfs will fail and return if we run it
as below:

  mkfs.xfs -m crc=1,finobt=1 -m crc=0 ....

Then _scratch_mkfs_xfs can deal with this problem. But for old
xfsprogs ( < v4.7), it replace the first "crc=1" with the second
"crc=0". Then "crc=0,finobt=1" cause a warning, but keep running:

  "warning: finobt not supported without CRC support, disabled."

This extra warning breaks the golden image of xfs/288, so filter
it out in case.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agoxfs/196: fallback to fail_writes for old kernel
Zorro Lang [Wed, 24 May 2017 14:52:58 +0000 (22:52 +0800)]
xfs/196: fallback to fail_writes for old kernel

linux XFS rename all "fail_writes" references to "drop_writes" in
v4.11. Some old kernel still use the name "fail_writes", e.g.
RHEL-7. For testing on old kernel, we need to fallback to
"fail_writes".

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agosrc/seek_sanity_test: fix test15 SEEK_HOLE expected results
Luis Henriques [Tue, 23 May 2017 16:19:55 +0000 (17:19 +0100)]
src/seek_sanity_test: fix test15 SEEK_HOLE expected results

Filesystesm with the "default behavior" will always return the
offset of the end of the file when lseek'ing with SEEK_HOLE.  This
test does the following:

 - fallocate 4 << 20 bytes
 - write PAGE_SIZE bytes at offset 0
 - writes PAGE_SIZE bytes at offset 4 << 20

Thus, using lseek in an FS with the "default behavior" will set the
position at 4 << 20 + PAGE_SIZE.

Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Luis Henriques <lhenriques@suse.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agoxfs/293: Make 'man' hard requirement
Nikolay Borisov [Tue, 23 May 2017 14:16:40 +0000 (17:16 +0300)]
xfs/293: Make 'man' hard requirement

If xfs/293 is run on a system which doesn't have 'man' installed
it will hang the due to $CAT waiting for input indefinitely. Also
create an entry for $MAN_PROG and use the cached $MANPAGE instead
of repeatedy calling $MAN_PROG --page

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agosrc/stat_test: Fix stx_attributes check
Richard Weinberger [Sat, 20 May 2017 22:06:13 +0000 (00:06 +0200)]
src/stat_test: Fix stx_attributes check

I found that this test succeeds on UBIFS:
stat_test /mnt/foo attr=+compressed attr=-compressed

Since stx_attributes can hold many flags, check the flags
correctly with the & operator.

Signed-off-by: Richard Weinberger <richard@nod.at>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agosrc: fix compiler warnings
Theodore Ts'o [Mon, 22 May 2017 00:29:12 +0000 (20:29 -0400)]
src: fix compiler warnings

Most of the fixes are printf format type warnings, but apparently GCC
6 is smart enough to realize is that if you don't do proper error
checking with posix_memalign, the resulting pointer can be undefined,
and whines about it.  So while fixing this in aio-dio-fcntl-race, I
also cleaned up the error checking and reporting.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agofstests: skip AIO-related tests when CONFIG_AIO=n
Eric Biggers [Thu, 18 May 2017 22:49:10 +0000 (15:49 -0700)]
fstests: skip AIO-related tests when CONFIG_AIO=n

When running xfstests on a kernel configured with CONFIG_AIO=n, all
AIO-related tests fail, often due to an error similar to the
following:

    error Function not implemented during io_setup

This affected at least the following tests: generic/036,
generic/112, generic/113, generic/198, generic/207, generic/208,
generic/210, generic/211, generic/239, generic/323, generic/427,
xfs/240, xfs/241.

Fix this by enhancing the 'feature' program to allow testing for
asynchronous I/O support, then skipping all AIO-related tests when
AIO is unsupported.

This change is useful because CONFIG_AIO is sometimes disabled to
reduce the kernel's attack surface (e.g. see
https://android-review.googlesource.com/#/c/292158/).

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agobtrfs: regression test for nocsum buffered read's repair
Liu Bo [Wed, 17 May 2017 22:36:10 +0000 (16:36 -0600)]
btrfs: regression test for nocsum buffered read's repair

This is to test whether buffered read retry-repair code is able to
work in raid1 case as expected.

Please note that without checksum, btrfs doesn't know if the data
used to repair is correct, so repair is more of resync which makes
sure that both of the copy has the same content.

Commit 20a7db8ab3f2 ("btrfs: add dummy callback for
readpage_io_failed and drop checks") introduced the regression.

The upstream fix is commit 9d0d1c8b1c9d ("Btrfs: bring back repair
during read")

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Filipe Manana <fdmanana@gmail.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agobtrfs: regression test for nocsum dio read's repair
Liu Bo [Wed, 17 May 2017 22:36:09 +0000 (16:36 -0600)]
btrfs: regression test for nocsum dio read's repair

Commit 2dabb3248453 ("Btrfs: Direct I/O read: Work on sectorsized
blocks") introduced this regression.  It'd cause 'Segmentation
fault' error.

The upstream fix is commit 97bf5a5589aa ("Btrfs: fix segment fault
when doing dio read")

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Filipe Manana <fdmanana@gmail.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agobtrfs: regression test for btrfs buffered read's repair
Liu Bo [Wed, 17 May 2017 22:36:08 +0000 (16:36 -0600)]
btrfs: regression test for btrfs buffered read's repair

This case tests whether buffered read can repair the bad copy if we
have a good copy.

Commit 20a7db8ab3f2 ("btrfs: add dummy callback for readpage_io_failed
and drop checks") introduced the regression.

The upstream fix is commit 9d0d1c8b1c9d ("Btrfs: bring back repair
during read")

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Filipe Manana <fdmanana@gmail.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agobtrfs: regression test for btrfs dio read repair
Liu Bo [Wed, 17 May 2017 22:36:07 +0000 (16:36 -0600)]
btrfs: regression test for btrfs dio read repair

This case tests whether dio read can repair the bad copy if we have
a good copy.

Commit 2dabb3248453 ("Btrfs: Direct I/O read: Work on sectorsized
blocks") introduced the regression.

The upstream fix is commit 2e949b0a5592 ("Btrfs: fix invalid
dereference in btrfs_retry_endio")

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Filipe Manana <fdmanana@gmail.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agocommon/filter: add _filter_filefrag
Liu Bo [Wed, 17 May 2017 22:36:06 +0000 (16:36 -0600)]
common/filter: add _filter_filefrag

_filter_filefrag is a helper function to filter filefrag's output
and it can be used to get a file's file offset and physical offset.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agofsstress: cleanup flist with test directory together
Zorro Lang [Wed, 17 May 2017 15:48:47 +0000 (23:48 +0800)]
fsstress: cleanup flist with test directory together

The "-c" option of fsstress will clean up the test directory after
each run. But it only does "rm -rf $dir". If run fsstress likes:

  fsstress -d $test_dir -n 1000 -p 10 -l 0 -c

fsstress will remove all test directories at the end of each run,
but the flist still save those *deleted* entries. It'll cause
more and more useless ENOENT failures. So we need to release all
entries in flist too.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: add regression test for DAX PTE/PMD races
Ross Zwisler [Wed, 17 May 2017 17:17:42 +0000 (11:17 -0600)]
generic: add regression test for DAX PTE/PMD races

This adds a regression test for the following kernel patches:

  mm: avoid spurious 'bad pmd' warning messages
  dax: Fix race between colliding PMD & PTE entries

The above patches fix two related PMD vs PTE races in the DAX code.
These can both be easily triggered by having two threads reading and
writing simultaneously to the same private mapping, with the key
being that private mapping reads can be handled with PMDs but
private mapping writes are always handled with PTEs so that we can
COW.

Without this 2-patch kernel series, the newly added test will result
in the following errors:

  run fstests generic/437 at 2017-05-16 16:53:43
  mm/pgtable-generic.c:39: bad pmd ffff8808daa49b88(84000001006000a5)
   ... a bunch of the bad pmd messages ...
  BUG: Bad rss-counter state mm:ffff8800a8c1b700 idx:1 val:1
  BUG: non-zero nr_ptes on freeing mm: 38
  XFS (pmem0p1): Unmounting Filesystem

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: Add more SEEK_HOLE tests
Jan Kara [Wed, 17 May 2017 12:04:05 +0000 (14:04 +0200)]
generic: Add more SEEK_HOLE tests

Add tests for bugs found in ext4 & xfs SEEK_HOLE implementations
fixed by following patches:

xfs: Fix missed holes in SEEK_HOLE implementation
ext4: Fix SEEK_HOLE

We add tests to seek_sanity_test as it is easiest to reuse its
infrastructure for seek tests, however not to regress generic/285
which uses seek_sanity_test we don't run new tests by default.
Instead we add options to select a range of tests to run and run new
tests from this new test.

[eguan: add $tmp definition and cleanup $tmp.* on exit]

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: test that encrypted filenames are presented without collisions
Eric Biggers [Tue, 16 May 2017 22:46:15 +0000 (15:46 -0700)]
generic: test that encrypted filenames are presented without collisions

Add a test which creates many similarly-named files in an encrypted
directory, then verifies they can be deleted without access to the
encryption key.  This is a regression test for two related bugs which
caused presented names to "collide" and point to the wrong inodes.
These bugs were present in the original versions of ext4 and f2fs
encryption, and they were fixed in v4.12-rc1.

Cc: linux-fscrypt@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agocommon: cleanup _require_xfs_io_command
Xiao Yang [Wed, 17 May 2017 01:42:33 +0000 (09:42 +0800)]
common: cleanup _require_xfs_io_command

We don't need to check specific flags at the end of this function
if we have checked them before. e.g, generic/071 and generic/422
are marked as notrun unexpectedly because xfs_io doesn't support
long-format help for falloc before xfsprogs v4.9.  Actually, xfs_io
has supported falloc, so these case should not be marked as notrun.

[eguan: declare local vars as local, rename param_check to
param_checked]

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agocommon: use _require_xfs_io_command() directly to check fiemap
Xiao Yang [Wed, 17 May 2017 01:42:32 +0000 (09:42 +0800)]
common: use _require_xfs_io_command() directly to check fiemap

1) _require_fiemap and _require_xfs_io_command "fiemap" do the
   same thing, but some test cases use the former and some use
   the latter, so i feel they should be unified.

2) The number of helpers like this is slowly growing, but it's
   easy to simply use _require_xfs_io_command directly and just
   specify the command we want to check.

This is just a cleanup for keeping it simple.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agooverlay/017: test consistent st_ino/d_ino for hardlinks
Amir Goldstein [Thu, 11 May 2017 06:55:09 +0000 (09:55 +0300)]
overlay/017: test consistent st_ino/d_ino for hardlinks

Currently hardlinks do not preserve the inode number across copy up,
so hardlinks did not participate in this test so far.

Stay honest and let the test verify what is was meant to verify and
let it fail because of the fact that hardlinks inode numbers are not
constant across copy up.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agooverlay/017: use t_dir_type to find file by d_ino
Amir Goldstein [Thu, 11 May 2017 06:55:08 +0000 (09:55 +0300)]
overlay/017: use t_dir_type to find file by d_ino

'find -ino' is this test was supposed to filter files by inode
number that was recorded with 'ls -i' to compare st_ino returned by
stat(2) with d_ino returned by getdents64(2).

It turns out that on some systems, 'find -ino' uses stat(2) for
filtering by inode number, which is not what we want.

Use the auxiliary program t_dir_type to filter files by inode number
instead.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agosrc/t_dir_type: support filtering by inode number
Amir Goldstein [Thu, 11 May 2017 06:55:07 +0000 (09:55 +0300)]
src/t_dir_type: support filtering by inode number

usage: t_dir_type <dir> <inode number>

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: Add a copy test for invalid input
Anna Schumaker [Wed, 10 May 2017 17:46:28 +0000 (13:46 -0400)]
generic: Add a copy test for invalid input

This test passes invalid argumnt combinations to the copy_file_range()
system call to test that input is verified before attempting to copy.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: Add a copy test for overwriting small amounts of data
Anna Schumaker [Wed, 10 May 2017 17:46:27 +0000 (13:46 -0400)]
generic: Add a copy test for overwriting small amounts of data

This test is similar to the previous one, except that it copies one
byte at a time to make sure that this case works as expected.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: Add copy test that overwrites data
Anna Schumaker [Wed, 10 May 2017 17:46:26 +0000 (13:46 -0400)]
generic: Add copy test that overwrites data

Using copy to overwrite data in the destination file is perfectly
valid, so let's make sure this case works as expected.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: Add small copies to new file test
Anna Schumaker [Wed, 10 May 2017 17:46:25 +0000 (13:46 -0400)]
generic: Add small copies to new file test

This test copies single bytes from a source file into various new
files just to make sure that we can handle very small copies.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: Add copy to new file test
Anna Schumaker [Wed, 10 May 2017 17:46:24 +0000 (13:46 -0400)]
generic: Add copy to new file test

This test copies data from various points in a source file to a new
file.  This is useful for testing the basics of copy_file_range().

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agosrc/seek_sanity_test: ensure file size is big enough
Luis Henriques [Mon, 8 May 2017 15:12:27 +0000 (16:12 +0100)]
src/seek_sanity_test: ensure file size is big enough

Tests test07, test08, and test09 preallocate a file and assume the
file size used is bigger than 10xbufsz (100xbufsz for test09).  This
patch adjusts the file size so this assumption is always true.

As an example, here's test07 output for cephfs, where the allocation
size is set to 4194304, and the output is (4194304 * 10 + 4194304)

  07. Test file with unwritten extents, only have dirty pages
  07.01 SEEK_HOLE expected 0 or 4194304, got 46137344.              FAIL
  07.02 SEEK_HOLE expected 1 or 4194304, got 46137344.              FAIL

Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agocommon/config: implement set_prog_path() using 'type -P'
Eric Biggers [Sat, 6 May 2017 00:19:33 +0000 (17:19 -0700)]
common/config: implement set_prog_path() using 'type -P'

Bash's 'type -P' builtin is equivalent to 'which', but it's more
efficient because it doesn't involve executing an external binary.
Because set_prog_path() is executed 60+ times in common/config,
which is sourced by common/rc, which in turn is sourced by every
test, switching to 'type -P' actually can make a noticeable
performance improvement for short-running or skipped tests.  For
example:

Before:
    # time ./check generic/002
    ...
    Passed all 1 tests

    real    0m1.365s
    user    0m0.746s
    sys     0m0.644s

After:
    # time ./check generic/002
    ...
    Passed all 1 tests

    real    0m1.026s
    user    0m0.511s
    sys     0m0.470s

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agocommon/config: make set_prog_path() accept one argument only
Eric Biggers [Sat, 6 May 2017 00:19:32 +0000 (17:19 -0700)]
common/config: make set_prog_path() accept one argument only

All callers of set_prog_path() pass it only one argument, the
program to find on the $PATH.  Therefore, to simplify things remove
the unused code which allowed fallback paths to be specified in the
remaining arguments.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: test revalidation of encrypted dentries
Eric Biggers [Thu, 4 May 2017 21:55:48 +0000 (14:55 -0700)]
generic: test revalidation of encrypted dentries

Add a test which verifies that dentries in an encrypted directory
are invalidated when an encryption key is added --- which should
cause the plaintext filenames to be visible and accessible,
replacing the encoded ciphertext filenames and any negative dentries
for the plaintext names.  This primarily tests for a bug which was
fixed in the v4.5 kernel, plus a v4.6 fix for incorrect RCU usage in
the earlier fix.

Cc: linux-fscrypt@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agopunch-alternating: add some options
Eric Sandeen [Thu, 4 May 2017 18:25:05 +0000 (13:25 -0500)]
punch-alternating: add some options

I didn't end up using this, but somebody else might find
it useful, so sending it.

This change lets us specify punch patterns other than
literally every other block.

i.e. punch-alternating with no options will do:

...HDHDHDHDHDHD...

-i 4 -s 2 will do:

...DDHHDDHHDDHH...

or -i 3 -s 1 will do:

...DDHDDHDDHDDH...

[eguan: don't allow 0 size and fixed perror string]

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agoattr: add support for cephfs
Luis Henriques [Wed, 3 May 2017 10:54:13 +0000 (11:54 +0100)]
attr: add support for cephfs

Block size for cephfs is 4M, which makes generic/020 test fail as the
value for MAX_ATTRS and MAX_ATTRVAL_SIZE will be too high.  Restrict these
two variables to sane values for this FSTYP.

Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <ukernel@gmail.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agocommon/rc: catch updated suspicious RCU usage message in _check_dmesg()
Eric Biggers [Thu, 4 May 2017 00:57:30 +0000 (17:57 -0700)]
common/rc: catch updated suspicious RCU usage message in _check_dmesg()

In the v4.11 kernel, the suspicious RCU usage message uses the word
"ERR" rather than "INFO".  Update _check_dmesg to accept both
versions.

[eguan: see kernel commit 4d4f88fa235f ("lockdep: Make RCU
suspicious-access splats use pr_err")]

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agoxfs: test fragmented multi-fsb readdir
Eric Sandeen [Thu, 4 May 2017 00:21:19 +0000 (19:21 -0500)]
xfs: test fragmented multi-fsb readdir

Regression test for kernel commit:
023cc840 xfs: handle array index overrun in xfs_dir2_leaf_readbuf()

See commit for detailed problem description.

tl;dr: readahead on weirdly fragmented multi-block directories
was broken.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agooverlay/017: test persistent inode numbers after mount cycle
Amir Goldstein [Fri, 28 Apr 2017 08:24:48 +0000 (11:24 +0300)]
overlay/017: test persistent inode numbers after mount cycle

Overlayfs directory inodes are constant across copy up,
but not persistent on mount cycle.

Compare the inode numbers before and after mount cycle.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agooverlay/017: verify constant inode number after rename
Amir Goldstein [Fri, 28 Apr 2017 08:24:47 +0000 (11:24 +0300)]
overlay/017: verify constant inode number after rename

The test verifies constant inode number after copy up.

Verify that inode number remains constant also after rename
and drop caches (when overlayfs needs to find the lower
inodes in another location).

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agooverlay/017: create helpers to record and check inode numbers
Amir Goldstein [Fri, 28 Apr 2017 08:24:46 +0000 (11:24 +0300)]
overlay/017: create helpers to record and check inode numbers

Use helpers to records and check inode numbers so we can repeat
the same test after rename and mount cycle.

Suggested-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agooverlay/017: use af_unix to create socket test file
Amir Goldstein [Fri, 28 Apr 2017 08:24:45 +0000 (11:24 +0300)]
overlay/017: use af_unix to create socket test file

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agooverlay/017: fix some comments
Amir Goldstein [Fri, 28 Apr 2017 08:24:44 +0000 (11:24 +0300)]
overlay/017: fix some comments

Align all comments to the term 'constant inode numbers' and
explain why hardlinks are excluded from this test.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agooverlay/017: silence test output
Amir Goldstein [Fri, 28 Apr 2017 08:24:43 +0000 (11:24 +0300)]
overlay/017: silence test output

Change test to output golden silence on success.

We are going to run the same check several times,
so instead of cloning the test output, cloning the
silence will be more conveniet.

Generalize cleanup of temp files for the same reason.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agoxfs: xfs_growfs target path must be an active xfs mountpoint
Bill O'Donnell [Thu, 27 Apr 2017 18:31:10 +0000 (13:31 -0500)]
xfs: xfs_growfs target path must be an active xfs mountpoint

xfs_growfs manpage clearly states that the target path must be an
active xfs mountpoint. This is a test to ensure that if the target
path isn't an active xfs mountpoint, the command is rejected. The
purpose is to check the command response, but not necessarily the
functionality of xfs_growfs. Test cases include absolute paths,
relative paths, symbolic links, and bind mounts.

Signed-off-by: Bill O'Donnell <billodo@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: add regression test for stale mmap reads
Ross Zwisler [Wed, 26 Apr 2017 18:05:31 +0000 (12:05 -0600)]
generic: add regression test for stale mmap reads

This adds a regression test for the following kernel patch:

  dax: fix data corruption due to stale mmap reads

The above patch fixes an issue where users of DAX can suffer data
corruption from stale mmap reads via the following sequence:

- open an mmap over a 2MiB hole

- read from a 2MiB hole, faulting in a 2MiB zero page

- write to the hole with write(3p).  The write succeeds but we incorrectly
  leave the 2MiB zero page mapping intact.

- via the mmap, read the data that was just written.  Since the zero page
  mapping is still intact we read back zeroes instead of the new data.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: test eofblocks race with file extending aio dio writes
Zorro Lang [Wed, 26 Apr 2017 16:23:36 +0000 (00:23 +0800)]
generic: test eofblocks race with file extending aio dio writes

It's possible for post-eof blocks to end up being used for direct
I/O writes. dio write performs an upfront unwritten extent
allocation, sends the dio and then updates the inode size (if
necessary) on write completion. If a file release occurs while a
file extending dio write is in flight, it is possible to mistake the
post-eof blocks for speculative preallocation and incorrectly
truncate them from the inode. This means that the resulting dio
write completion can discover a hole and allocate new blocks rather
than perform unwritten extent conversion.

A kernel warning can be reproduced by generic/299 on XFS:
  XFS: Assertion failed: tp->t_blk_res_used <= tp->t_blk_res, \
       file: fs/xfs//xfs_trans.c, line: 309

The root cause is that xfs_free_eofblocks() uses i_size to truncate
post-eof blocks from the inode, but async, file extending direct
writes do not update i_size until write completion, long after inode
locks are dropped. Therefore, xfs_free_eofblocks() effectively
truncates the inode to the incorrect size.

Besides reproduce above kernel warning, the verification of written
data is an important distinction between this test and generic/299.
For cover this filesystem corruption testing, write this new case to
check data integrality manually, not only depend on a kernel
warning.

To increase the test stress of aio-dio-eof-race, add two arguments
to this source code to change the file size will be written.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agobuild: allow cros-compilation on chromeOS
Gwendal Grignou [Wed, 19 Apr 2017 23:33:48 +0000 (16:33 -0700)]
build: allow cros-compilation on chromeOS

- Request LIBTOOL to be used
- Set topbuildir based on a Makefile variable to call libtool
- Use /usr/local instead of /var for xfstest final location
- Move macros from aclocal.m4 to acinclude.m4, aclocal.m4 is autogenerated.
- Use autoconf variables @prefix@, @exec_prefix@.

The regular way of compiling xfstests - make - remains.
But it now runs autoreconf and libtoolize -i to produce a valid
configure.
Verified with 'make install --dry-run' that files are installed at the
same place.
Verified compiling in chromeOS chroot works as well.

[eguan: resolve merge conflicts and update .gitignore and remove
generated files by realclean]

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agoxfs: xfs_repair should junk empty attribute leaf blocks
Zorro Lang [Thu, 13 Apr 2017 07:31:09 +0000 (15:31 +0800)]
xfs: xfs_repair should junk empty attribute leaf blocks

There was a bug during log replay, the attr/attr3 leaf verifier
reported corruption when encountering a leaf attribute with a
count of 0 in the header, as below:

Metadata corruption detected at xfs_attr3_leaf block 0x480988/0x1000

commit f714016 from xfsprogs has fixed this bug. This test case
will emulate this corruption by xfs_db and use xfs_repair to fix
it.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agosrc/t_mmap_dio: fix incorrect argument count check
Ross Zwisler [Mon, 24 Apr 2017 17:49:31 +0000 (11:49 -0600)]
src/t_mmap_dio: fix incorrect argument count check

t_mmap_dio.c actually requires 4 arguments, not 3 as the current
check enforces:

usage: t_mmap_dio <src file> <dest file> <size> <msg>
open src(No such file or directory) len 0 (null)

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Fixes: 456581661b4d ("xfs: test per-inode DAX flag by IO")
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agobtrfs: fix local array declarations
Filipe Manana [Fri, 21 Apr 2017 15:00:52 +0000 (16:00 +0100)]
btrfs: fix local array declarations

We were declaring local arrays using a notation that does not seem to be
standard resulting in failures on some systems, like for example in a
Debian Stretch installation with bash version 4.4.11(1)-release:

$ ./check btrfs/003 btrfs/027
FSTYP         -- btrfs
PLATFORM      -- Linux/x86_64 debian3 4.10.0-rc8-btrfs-next-37+
MKFS_OPTIONS  -- /dev/sdc
MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1

btrfs/003 45s ... [failed, exit status 1] - output mismatch (see /home/fdmanana/git/hub/xfstests/results//btrfs/003.out.bad)
    --- tests/btrfs/003.out 2016-08-23 10:17:35.027012095 +0100
    +++ /home/fdmanana/git/hub/xfstests/results//btrfs/003.out.bad 2017-04-21 15:53:58.807366940 +0100
    @@ -1,2 +1,4 @@
     QA output created by 003
    -Silence is golden
    +./tests/btrfs/003: line 102: devs[]: bad array subscript
    +dev balance failed
    +(see /home/fdmanana/git/hub/xfstests/results//btrfs/003.full for details)
    ...
    (Run 'diff -u tests/btrfs/003.out /home/fdmanana/git/hub/xfstests/results//btrfs/003.out.bad'  to see the entire diff)
btrfs/027 7s ... [failed, exit status 1] - output mismatch (see /home/fdmanana/git/hub/xfstests/results//btrfs/027.out.bad)
    --- tests/btrfs/027.out 2016-08-23 10:17:35.035012077 +0100
    +++ /home/fdmanana/git/hub/xfstests/results//btrfs/027.out.bad 2017-04-21 15:53:59.835367271 +0100
    @@ -1,2 +1,7 @@
     QA output created by 027
     Silence is golden
    +./common/rc: line 935: devs[]: bad array subscript
    +./common/rc: line 893: devs[]: bad array subscript
    +mkfs -m raid1 -d raid1 failed
    +Bug: str empty, must call _spare_dev_get before its put
    +(see /home/fdmanana/git/hub/xfstests/results//btrfs/027.full for details)
    ...
    (Run 'diff -u tests/btrfs/027.out /home/fdmanana/git/hub/xfstests/results//btrfs/027.out.bad'  to see the entire diff)
Ran: btrfs/003 btrfs/027
Failures: btrfs/003 btrfs/027
Failed 2 of 2 tests

So fix this by changing the declaration pattern "local dev[]=..." to the
standard way of "local -a dev=...".

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agobtrfs: use $FILEFRAG_PROG instead of filefrag
Xiao Yang [Fri, 21 Apr 2017 10:10:40 +0000 (18:10 +0800)]
btrfs: use $FILEFRAG_PROG instead of filefrag

$FILEFRAG_PROG has been defined in common/config, so
we could apply it.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agoext4: check mount's handling for very large s_first_meta_bg
Xiao Yang [Fri, 21 Apr 2017 10:10:39 +0000 (18:10 +0800)]
ext4: check mount's handling for very large s_first_meta_bg

On ext4 filesystem, the kernel carshes at mount time when
s_first_meta_bg's value exceeds the largest possible meta_bg
number.  This kernel bug has been fixed in:

3a4b77c ext4: validate s_first_meta_bg at mount time

[eguan: add comments on the first_meta_bg value]

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoxfs/293: make test more robust
Eric Sandeen [Thu, 20 Apr 2017 15:30:36 +0000 (10:30 -0500)]
xfs/293: make test more robust

xfs/293 is supposed to make sure every command in xfs_io
is documented, but it was missing the inode command because
it's a common word, and depending on how man formatted the
page, the magic "   inode" string could show up and appear
to indicate that documentation is present for the command
when it's not actually there.

Change the test to inspect the manpage source directly, with
the assumption that each documented command will start
with ^\.B.*$COMMAND on a manpage line.

This handles a few different compressed manpage formats -
I don't know if anybody uses bz2 or xz, but hey.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agofstests: add generic test for file handles
Amir Goldstein [Wed, 19 Apr 2017 16:29:19 +0000 (19:29 +0300)]
fstests: add generic test for file handles

Cloned from xfs specific test xfs/238, which checks
stale file handles of deleted files.

This test uses the generic open_by_handle_at() syscall
and also tests for non-stale file handles of linked files.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agosrc/open_by_handle: flexible usage options
Amir Goldstein [Wed, 19 Apr 2017 16:29:18 +0000 (19:29 +0300)]
src/open_by_handle: flexible usage options

More usage options for testing open_by_handle, which are needed
for testing stable handles across copy up in overlayfs.

usage: open_by_handle [-c|-l|-u|-d] <test_dir> [num_files]

Examples:

1. Create test set of N files and try to get their NFS handles:

   open_by_handle -c <test_dir> [N]

   This is used by new helper _require_exportfs() to check
   if filesystem supports exportfs

2. Get file handles for existing test set, drop caches and try to
   open all files by handle:

   open_by_handle <test_dir> [N]

3. Get file handles for existing test set, unlink all test files,
   drop caches, try to open all files by handle and expect ESTALE:

   open_by_handle -d <test_dir> [N]

4. Get file handles for existing test set, hardlink all test files,
   then unlink the original files, drop caches and try to open all
   files by handle (should work):

   open_by_handle -l <test_dir> [N]
   open_by_handle -u <test_dir> [N]

   This test is done with 2 invocations of the program, first to
   hardlink (-l) and then to unlink the originals (-u), because
   we would like to be able to perform the hardlinks on overlay
   lower layer and unlink on upper layer.

   NOTE that open_by_handle -u doesn't check if the files are
   hardlinked, it just assumes that they are.  If they are not
   then the test will fail, because file handles would be stale.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agosrc/open_by_handle: program to exercise open_by_handle_at() syscall
Amir Goldstein [Wed, 19 Apr 2017 16:29:17 +0000 (19:29 +0300)]
src/open_by_handle: program to exercise open_by_handle_at() syscall

This is a clone of src/stale_handle.c test that uses generic
open_by_handle_at() syscall instead of the xfs specific ioctl.

No test is using this program yet.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agofstests: remove IRIX test program open_unlink
Amir Goldstein [Wed, 19 Apr 2017 16:29:16 +0000 (19:29 +0300)]
fstests: remove IRIX test program open_unlink

It does not seem to be used by any test.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric: fix statx definition for non-x86 architecture
Gwendal Grignou [Wed, 19 Apr 2017 23:54:53 +0000 (16:54 -0700)]
generic: fix statx definition for non-x86 architecture

Fix a compilation error for ARM:
__ILP32__ is defined but not __X32_SYSCALL_BIT.

The check should only apply for x86_64 architecture, statx for other
architectures is not implemented yet - see commit 7acc839c9e57
"statx: Add a system call to make enhanced file info available".

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoxfs/348: update error message when transmogrifying symlink into directory
Darrick J. Wong [Thu, 13 Apr 2017 15:39:43 +0000 (08:39 -0700)]
xfs/348: update error message when transmogrifying symlink into directory

We introduced the inline directory verifier in 4.11 to prevent the
system from trying to use corrupt inline directories.  This has the
effect of changing the error message in one step of the i_mode fuzz
tester, so update the test accordingly.

Note that prior to the existence of the verifier, this test would
occasionally result in memory corruption that did not become evident
until later.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric: test FIEMAP on extended attribute blocks
Darrick J. Wong [Thu, 6 Apr 2017 16:01:30 +0000 (09:01 -0700)]
generic: test FIEMAP on extended attribute blocks

Make sure that FIEMAP produces some output when we add enough xattrs
to force the xattrs to be stored in an external block.

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>
7 years agobtrfs: remove snapshot aware defrag test
Liu Bo [Wed, 12 Apr 2017 01:27:18 +0000 (18:27 -0700)]
btrfs: remove snapshot aware defrag test

Since snapshot aware defrag has been disabled in kernel, and we all
have learned to ignore the failure of btrfs/010, lets just remove
it.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric: Check the stx_attributes settable by chattr
David Howells [Mon, 10 Apr 2017 13:33:12 +0000 (14:33 +0100)]
generic: Check the stx_attributes settable by chattr

Check the stx_attributes that can be set by calling chattr.

The script probes the filesystem with chattr to find out which of
+a, +c, +d and +i are supported before testing combinations of
attrs.  Note that if a filesystem supports chattr with these, but
doesn't paste the flag values into stx_attributes, the test will
fail as there's no way to distinguish cleared from unset.

Certain chattr flags are reflected in specific stx_attributes flags:

chattr flag stx_attributes flag
+a STATX_ATTR_APPEND
+c STATX_ATTR_COMPRESSED
+d STATX_ATTR_NODUMP
+i STATX_ATTR_IMMUTABLE

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agodoc: Partially expand the documentation
David Howells [Mon, 10 Apr 2017 13:33:00 +0000 (14:33 +0100)]
doc: Partially expand the documentation

Partially expand the documentation available in xfstests to include
requirements checking and auxiliary programs for testing.

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>
7 years agogeneric: Add first statx test
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).

For example:

./src/stat_test /dev/null \
       stx_type=char \
       stx_rdev_major=3 \
       stx_rdev_minor=8 \
       stx_nlink=1 \
       ref=/dev/zero \
       ts=B,b

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>
7 years agofstests: Add an auxiliary program to create an AF_UNIX socket
David Howells [Mon, 10 Apr 2017 13:32:44 +0000 (14:32 +0100)]
fstests: Add an auxiliary program to create an AF_UNIX socket

Add an auxiliary program to create an AF_UNIX socket at the
specified location so that tests can do things with it.

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>
7 years agogeneric/422: check fallocate KEEP_SIZE flag correctly
Eryu Guan [Mon, 10 Apr 2017 03:02:57 +0000 (11:02 +0800)]
generic/422: check fallocate KEEP_SIZE flag correctly

This fixes a merge error in last update, "-k" should be passed to
_require_xfs_io_command() as a separate parameter.

Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agofstests: add orangefs (pvfs2) support
Martin Brandenburg [Fri, 7 Apr 2017 20:09:43 +0000 (16:09 -0400)]
fstests: add orangefs (pvfs2) support

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.

TEST_DIR=/mnt
TEST_DEV=tcp://server1vm:3334/orangefs
SCRATCH_MNT=/scratch
SCRATCH_DEV=tcp://server1vm:3334/scratch

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agosrc/t_immutable: add ftruncate to append only tests
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.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agooverlay: test immutable and append-only upper files
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.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric/071: check if fs supports fallocate KEEP_SIZE flag
Filipe Manana [Tue, 4 Apr 2017 06:34:31 +0000 (07:34 +0100)]
generic/071: check if fs supports fallocate KEEP_SIZE flag

So that the test is skipped for filesystems that don't support it
instead of failing (like NFS 4.2 for example).

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric: test for number of bytes used by files after buffered writes
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:

 "Btrfs: fix reported number of inode blocks"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agocommon/rc: check fs supports xfs_io falloc's specific flags
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.

Suggested-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric/079: use _require_test_program
Amir Goldstein [Thu, 6 Apr 2017 05:49:19 +0000 (08:49 +0300)]
generic/079: use _require_test_program

use _require_test_program helper and specify both +i and +a
to _required_chattr, because test sets them both.

Also remove unneeded _scratch_unmount from _cleanup.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agofstests: _require_chattr() must get an input arg
Amir Goldstein [Thu, 6 Apr 2017 05:49:18 +0000 (08:49 +0300)]
fstests: _require_chattr() must get an input arg

_require_chattr() was never intended to be called without an input
argument (specifiying the required attribute to set).

However, calling it without input arguments did work and error
was silently discarded into full test output.

Fix the function to abort on missing input argument and fix the
only test that called _require_chattr() with no input argument.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agofstests: Remove IRIX os support from template
Qu Wenruo [Wed, 5 Apr 2017 03:26:28 +0000 (11:26 +0800)]
fstests: Remove IRIX os support from template

Since the last release of IRIX is already 10 years ago and support
for it has ended after 2014, there is no need to support IRIX any
way.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric: test encryption key revocation during concurrent I/O
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>
7 years agogeneric: Add test for fallocate() PUNCH_HOLE|KEEP_SIZE
Calvin Owens [Sat, 1 Apr 2017 01:13:41 +0000 (18:13 -0700)]
generic: Add test for fallocate() PUNCH_HOLE|KEEP_SIZE

Verify that punching holes at ends of files does not alter st_size
if we pass FALLOC_FL_KEEP_SIZE to fallocate().

[eguan: add comment about xfs_io's fpunch KEEP_SIZE flag]

Signed-off-by: Calvin Owens <calvinowens@fb.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agobtrfs: use full subcommand names
David Sterba [Thu, 30 Mar 2017 15:06:33 +0000 (17:06 +0200)]
btrfs: use full subcommand names

Update the remaining calls to 'btrfs' that use shortened command
names.  Use of full names is recommended to avoid any ambiguities.

Signed-off-by: David Sterba <dsterba@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agobtrfs: reorder arguments so that options come first
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.

The canonical form should be:

  btrfs command subcommand [-options] [arguments]

Signed-off-by: David Sterba <dsterba@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoxfs/068: update golden output due to new operations in fsstress
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.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agofsstress: add mwrite/mread into test operation list
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.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoext4: test mounting filesystem with encrypted inode on orphan list
Eric Biggers [Thu, 23 Mar 2017 19:16:08 +0000 (12:16 -0700)]
ext4: test mounting filesystem with encrypted inode on orphan list

Add an ext4-specific regression test for a bug which caused ext4 to
crash when mounting a filesystem which had an encrypted inode on its
orphan list.

This bug was present in kernels v4.1 and later.  It has been fixed
in v4.11-rc1, v4.10.4, v4.9.16, and v4.4.55.

Cc: Theodore Ts'o <tytso@mit.edu>
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>
7 years agocommon/rc: support gluster volume start with a slash
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.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>