Commit Graph

3144 Commits

Author SHA1 Message Date
Darrick J. Wong c7daab5f35 xfs: test fuzzing every field of a dquot
See what happens when we fuzz every field of a quota information structure.

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>
2017-08-24 17:05:19 +08:00
Darrick J. Wong 52cea8a147 common/populate: enable xfs quota accounting
When we're creating a populated xfs image, turn on quotas so that we can
fuzz those fields too.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-24 11:15:52 +08:00
Darrick J. Wong 86b3f79bbe xfs: test xfs_db fuzz command verbs
Ensure that the fuzz command does what it says.

[eguan: fixed test failures on non-CRC XFS]

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>
2017-08-22 15:08:05 +08:00
Darrick J. Wong 56a2da0467 common/fuzzy: fix fuzz verb scanning
As part of upstreaming, the xfs_db fuzz command change the help output
which breaks the fuzzers' ability to detect fuzz verbs.  Fix that.

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>
2017-08-22 11:20:07 +08:00
Brian Foster 1cc5517771 xfs: test for log recovery failure after tail overwrite
XFS is susceptible to log recovery problems if the fs crashes under
certain circumstances. If the tail has been pinned for long enough
to the log to fill and the next batch of log buffer submissions
happen to fail, the filesystem shuts down having potentially
overwritten part of the range between the last good tail->head range
in the log. This causes log recovery to fail with crc mismatch or
invalid log record errors.

Add a test that uses XFS DEBUG mode error injection to force the
tail overwrite condition with a known bad (crc mismatch) log write
and tests that log recovery succeeds. Note that this problem is
currently only reproducible with larger (non-default) log buffer
sizes (i.e., '-o logbsize=256k') or smaller block sizes (1k).

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-18 13:39:34 +08:00
Amir Goldstein e4caca53e2 overlay: test mount error cases with index=on
- Upper/lower mismatch
- Index/upper mismatch

With index=on, lowerdir and upperdir are verified using a file
handle stored in trusted.overlay.origin xattr in upperdir and
indexdir.

Failure to verify lowerdir/upperdir on mount results in ESTALE.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-18 13:39:34 +08:00
Lu Fengqi 4dbba416d9 btrfs/142: enhance regression test for nocsum dio read's repair
I catch this following error from dmesg when this testcase fails.

[17446.661127] Buffer I/O error on dev sdb1, logical block 64, async page read

We expect to inject disk IO errors on the device when xfs_io reads
the specific file, but other processes may trigger IO error earlier.
So, we can use task-filter to solve this problem.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-18 13:39:34 +08:00
Filipe Manana 80bd724d02 btrfs: test incremental send with compression and extent cloning
Test that an incremental send/receive operation will not fail when the
destination filesystem has compression enabled and the source filesystem
has a 4K extent at a file offset 0 that is not compressed and that is
shared.

This currently fails on btrfs and is fixed by the following patch for the
linux kernel:

  "Btrfs: incremental send, fix emission of invalid clone operations"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-18 13:39:27 +08:00
Xiao Yang 70076b9394 xfs/424: add check for finobt && update comments
1) This test can check if setting types causes error regardless of
   supporting crc, so we can update existed comments about it.  We
   also add new comments about known issues triggered in this test.

2) When finobt is disabled, xfs_db fails to get current address of
   free_root, as below:
   xfs_db -c "agi" -c "addr free_root" -c "daddr" /dev/sda11
   Metadata CRC error detected at xfs_inobt block 0x0/0x1000
   ...
   Running related tests without finobt makes no sense, so we add
   check for finobt.

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>
2017-08-15 17:20:13 +08:00
Zorro Lang 4939477f3f generic: test read around EOF
As posix standard, if the file offset is at or past the end of file,
no bytes are read, and read() returns zero. There was a bug, when
DIO read offset is just past the EOF a little, but in the same block
with EOF, read returns different negative values.

Kernel commit 74cedf9b6c60 ("direct-io: Fix negative return from dio
read beyond eof") and commit 2d4594acbf6d ("fix the regression from
"direct-io: Fix negative return from dio read beyond eof"") fixed
the bug.

This case reads from range within EOF, past EOF and at EOF, to make
sure the return value as expected, especially read from past/at EOF
returns 0.

[eguan: update commit log and comments about information of the
specific bug, adjust read_test param order (offset, count, ret) and
test description]

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-15 14:37:59 +08:00
Ernesto A. Fernández 101f0c34ef generic/307: add test to acl group
Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-09 11:18:41 +08:00
Darrick J. Wong 4cca8b4ced common/inject: refactor helpers to use new errortag interface
Refactor the XFS error injection helpers to use the new errortag
interface to configure error injection.  If that isn't present, fall
back either to the xfs_io/ioctl based injection or the older sysfs
knobs.  Refactor existing testcases to use the new helpers.

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>
2017-08-07 20:01:50 +08:00
Xiao Yang adf56068b5 common/config: add acl and user_xattr support for TEST_DEV
On RHEL6.9GA, generic/097 fails for ext4 because _test_cycle_mount()
remount ext4 without the user_xattr option, so extended attributes
are not supported by ext4.

On some old kernels, ext4 filesystem can not be mounted with acl and
user_xattr options by default.  The following patch has enabled
these options by default:
'ea6633369458("ext4: enable acls and user_xattr by default")'

We add acl and user_xattr support in _test_mount_opts(), and it
works normally on all kernels.

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>
2017-08-07 19:55:43 +08:00
Eryu Guan 65e0cd588d common/config: unset TEST_FS_MOUNT_OPTS across config sections
TEST_FS_MOUNT_OPTS doesn't get reset before parsing next config
section, this will cause unexpected TEST_FS_MOUNT_OPTS in test,
because it can be assigned some fs-specific mount options in
_test_mount_opts, which might not be supported by the filesystem in
next config section. And MOUNT_OPTIONS is reset, I don't see why
TEST_FS_MOUNT_OPTS shouldn't be.

Also update README.config-sections to reflect this change and fix
typos (replace MOUNT_OPTIONS with TEST_FS_MOUNT_OPTS).

Reviewed-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-07 14:44:13 +08:00
Eryu Guan 81aa85deac fstests: remove tmp files properly
Some tests and common helpers don't properly clean up tmp files and
leave them behind in /tmp dir, and these tmp files are accumulating
over time.

Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-03 20:44:04 +08:00
Eryu Guan ce4616c888 fstests: batch update of test file mode
Some tests don't have x permission set in mode, git complains about
file mode change after running tests in fstests git repo dir. So
change all such tests to 755 mode. Performed by:

find tests ! -perm /111 -name [0-9][0-9][0-9] -exec chmod 755 {} \;

Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-03 20:44:04 +08:00
Eryu Guan 9b897c8055 common/xfs: add iomap_dio_actor() to the dmesg filter
The warning in fs/iomap.c::iomap_dio_actor() could be triggered when
mixing dio and mmap I/O on the same sparse file. Several tests could
hit this warning now, like generic/095 generic/224 and generic/446.
So add this expected warning to whitelist too.

Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-03 20:44:04 +08:00
Eryu Guan 505cb261e0 generic/224: filter out expected XFS warnings for mixed direct/buffer I/O
generic/224 is doing concurrent direct and buffered I/O to the same
set of files, and this triggers some expected warnings on XFS. So
filter out these warnings just like what we did in generic/095 and
generic/247.

Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-03 20:44:04 +08:00
Eryu Guan 9c129c6887 new: validate groups when creating new test
Allow only lower case letters, digits, spaces and underscore when
adding groups, give prompt if there's any not-allowed characters.
Also remove redundant spaces between groups.

Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-03 20:44:04 +08:00
Darrick J. Wong fed90418a7 ext4: fsmap tests
Test the GETFSMAP ioctl against ext4.

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>
2017-08-03 20:44:04 +08:00
Darrick J. Wong 93d6007671 xfs: only run scrub in dry run mode
When checking a filesystem, explicitly run xfs_scrub in dry run mode
so that it will not ever try to preen, fix, or optimize anything.

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>
2017-08-03 20:44:04 +08:00
Ernesto A. Fernández 6cce8575a5 generic/449: make the test effective against xfs
Setting acls on an xfs filesystem will succeed even after running
out of space for user attributes. Use trusted attributes instead.
Also speed up the test by setting large values for the attributes.

[eguan: use perl to generate attr value, and add comments on trusted
namespace]

Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-03 20:44:04 +08:00
Eric Biggers 85e3bf85c6 src: include <sys/sysmacros.h> for major() and minor()
This resolves the following deprecation warning (and other instances of
the same warning) when compiling with glibc 2.25 or later:

stat_test.c: In function 'cmp_statx':
stat_test.c:251:13: warning: In the GNU C Library, "major" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "major", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including <sys/types.h>.
  devcmp(dev);
             ^

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-03 20:43:57 +08:00
Eryu Guan 14d318429e generic/446: make sure all background processes are dead before umount
The $dread_pid refers to the while-true-do loop, wait for $dread_pid
doesn't mean the xfs_io direct read process is already dead,
sometimes xfs_io process is still running and blocking
_scratch_unmount.

Fix it by making the direct read does a fixed number of loop and
break out the second mmap-fpunch loop if the first loop exits. At
this point we're sure that there's no unfinished background process
blocking the umount.

Reviewed-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-07-28 18:53:51 +08:00
Tahsin Erdogan 606c652eee ext4: add a test for ea_inode feature
ea_inode feature supports creating extended attributes with values
greater than the fs block size. This test exercises some common
scenarios:

 - Extended attibute being placed in inode vs xattr block
 - Removing extended attribute
 - Removing a file that has an extended attribute
 - Multiple files having identical large attribute values
 - Repeatedly setting an extended attribute with various sizes

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-07-28 18:53:51 +08:00