xfstests-dev.git
6 years agogeneric: add test for executables on read-only DAX mounts
Ross Zwisler [Thu, 31 Aug 2017 04:09:10 +0000 (22:09 -0600)]
generic: add test for executables on read-only DAX mounts

This adds a regression test for the following kernel patch:

commit 42d4a99b09cb ("ext4: fix fault handling when mounted with -o
dax,ro")

The above patch fixes an issue with ext4 where executables cannot be
run on read-only filesystems mounted with the DAX option.

This issue does not appear to be present in ext2 or XFS, as they
both pass the test.  I've also confirmed outside of the test that
they are both indeed able to execute binaries on read-only DAX
mounts.

Thanks to Randy Dodgen for the bug report and reproduction steps.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Randy Dodgen <rdodgen@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agofsx: fix compile warnings
Amir Goldstein [Wed, 30 Aug 2017 14:51:37 +0000 (17:51 +0300)]
fsx: fix compile warnings

[eguan: fix conflicts with patch "fsx: Fix -Wformat-security
warnings"]

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/013: exit cleaner thread if fsstress dies
Darrick J. Wong [Wed, 30 Aug 2017 04:40:56 +0000 (21:40 -0700)]
xfs/013: exit cleaner thread if fsstress dies

In this test, the cleaner thread deletes the directory trees created
by fsstress in order to exercise the free inode btree code.
However, if fsstress dies, the cleaner can end up waiting forever
for a directory that will never be created, which hangs up the test
run. Therefore, abort if fsstress has ended.

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>
6 years agoxfs/{319,323}: don't checksum files after log recovery
Darrick J. Wong [Wed, 30 Aug 2017 04:40:50 +0000 (21:40 -0700)]
xfs/{319,323}: don't checksum files after log recovery

These two tests simulate log failure during a reflink operation.
However, the contents of the target of the reflink operation depend
on the block size, so we cannot hardcode md5 hashes in this test.
Since the whole point of the test is to ensure that the the complex
chain of transactions actually finishes no matter where the
interruption, it is sufficient simply to run the usual end-of-test
fsck to look for corrupt metadata.

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>
6 years agoxfs/095: require 512b sector size SCRATCH_DEV
Zorro Lang [Wed, 30 Aug 2017 06:26:45 +0000 (14:26 +0800)]
xfs/095: require 512b sector size SCRATCH_DEV

xfs/095 fails on 4k hard sector size device, due to it runs:

  _mkfs_log "-l version=1 -m crc=0 -d sectsize=512"

So _notrun if SCRATCH_DEV's sector size is bigger than 512b.

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 agofsx: Fix -Wformat-security warnings
Tuomas Tynkkynen [Tue, 29 Aug 2017 13:37:14 +0000 (16:37 +0300)]
fsx: Fix -Wformat-security warnings

Some distros (NixOS) have their build environment enable
-Werror=format-security by default for security/hardening reasons.
Currently fsx fails to build due to this:

fsx.c: In function 'prt':
fsx.c:215:18: error: format not a string literal and no format arguments [-Werror=format-security]
  fprintf(stdout, buffer);
                  ^
fsx.c:217:20: error: format not a string literal and no format arguments [-Werror=format-security]
   fprintf(fsxlogf, buffer);
                    ^
Indeed the compiler is correct here, if the message-to-be-printed were
to contain a '%', unpredictable things would happen. Fix this.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agosrc/t_mtab: Add newlines to error messages
Tuomas Tynkkynen [Tue, 29 Aug 2017 13:37:13 +0000 (16:37 +0300)]
src/t_mtab: Add newlines to error messages

I can't recall anymore what exactly I did to have tests using t_mtab
to fail, but nevertheless this commit adds the proper newlines.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agofsx: fix path of .fsx* files
Amir Goldstein [Wed, 23 Aug 2017 15:49:13 +0000 (18:49 +0300)]
fsx: fix path of .fsx* files

When command line arg -P <dirpath> is used, compose the
path for .fsxgood .fsxlog .fsxops files from dirpath and
work file basename.

This fix is ported from LTP.

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 agofsx: fixes to random seed
Amir Goldstein [Wed, 23 Aug 2017 15:49:12 +0000 (18:49 +0300)]
fsx: fixes to random seed

Not sure why, but with initstate()/setstate(), fsx generates
same events regadless of the input seed argument.

Change to use srandom() to fix the problem.

Add pid to auto random seed, so parallel fsx executions with auto
seed will use different seed values.

At this time there are 6 tests that use fsx, out of which:
2 use -S 0 as seed (gettime()) - generic/{075,112}
2 do not specify seed (default = 1) - generic/{091,263}
1 uses explicit constant seed - generic/127
1 uses explicit $RANDOM seed - generic/231

This change affects all those tests.
The tests that intended to randomize the seed will now really
randomize the seed.
The tests that intended to use a constant seed will still use
a constant seed, but resulting event sequence will be different
than before this change.

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 agocommon/rc: fix _require_xfs_io_command params check
Amir Goldstein [Wed, 23 Aug 2017 15:49:11 +0000 (18:49 +0300)]
common/rc: fix _require_xfs_io_command params check

When _require_xfs_io_command is passed command parameters,
the resulting error from invalid parameters may be ignored.

For example, the following bogus params would not abort the test:
_require_xfs_io_command "falloc" "-X"
_require_xfs_io_command "fiemap" "-X"

Fix this by looking for the relevant error message.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agocommon/rc: convert some egrep to grep
Amir Goldstein [Wed, 23 Aug 2017 15:49:10 +0000 (18:49 +0300)]
common/rc: convert some egrep to grep

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: test data integrity with mixed buffer read and aio dio write
Zorro Lang [Sat, 26 Aug 2017 13:26:36 +0000 (21:26 +0800)]
generic: test data integrity with mixed buffer read and aio dio write

When mixing buffered reads and asynchronous direct writes, it is
possible to end up with the situation where we have stale data in
the page cache while the new data is already written to disk.

This issue should be fixed by patch titled:

fs: Fix page cache inconsistency when mixing buffered and AIO DIO

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/420: truncate testfile before executing the test
Ilya Dryomov [Fri, 25 Aug 2017 12:04:41 +0000 (14:04 +0200)]
generic/420: truncate testfile before executing the test

If generic/437 is run before generic/420, the latter fails with:

  4c4
  < stat.size = 2048
  ---
  > stat.size = 2097152

because both use $TEST_DIR/testfile.  generic/437 leaves it at 2M,
while generic/420 assumes that it is empty (or at least smaller than
2048 bytes).

Use a private test file (testfile.$seq) and truncate it on open just in
case.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric/108: tolerate old lvm utility versions
Ilya Dryomov [Thu, 24 Aug 2017 12:48:26 +0000 (14:48 +0200)]
generic/108: tolerate old lvm utility versions

lvm utility in Ubuntu 14.04 LTS treats -l 100%FREE as a hard number
and not as an approximate upper limit.  With ~5G scratch partition
and ~128M scsi_debug device, vg_108 is 1279+31=1310 extents long,
but only 31*2=62 can be allocated with -i 2:

  # lvm lvcreate -i 2 -I 4m -l 100%FREE -n lv_108 vg_108
  Insufficient suitable allocatable extents for logical volume lv_108: 1248 more required

lvm2 commit 4b6e3b5e5ea6 ("allocation: Allow approximate
allocation when specifying size in percent") made '-l 100%FREE'
possible when creating RAID LVs or setting number of stripes.

Fix it by setting the size to allocate to 100M, which is enough for
the test with 128M scsi_debug device.

[eguan: update commit log a bit to mention the lvm2 commit that
changed the lvcreate behavior]

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agofstests: don't _require_metadata_journaling before _scratch_mkfs
Ilya Dryomov [Thu, 24 Aug 2017 14:17:38 +0000 (16:17 +0200)]
fstests: don't _require_metadata_journaling before _scratch_mkfs

This is obviously wrong and makes ./check -r skip over tests on ext4
with "ext4 on $DEV not configured with metadata journaling".

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agoxfs: test fuzzing every field of a dquot
Darrick J. Wong [Fri, 21 Jul 2017 22:04:58 +0000 (15:04 -0700)]
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>
6 years agocommon/populate: enable xfs quota accounting
Darrick J. Wong [Fri, 21 Jul 2017 22:04:52 +0000 (15:04 -0700)]
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>
6 years agoxfs: test xfs_db fuzz command verbs
Darrick J. Wong [Sat, 19 Aug 2017 15:46:45 +0000 (08:46 -0700)]
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>
6 years agocommon/fuzzy: fix fuzz verb scanning
Darrick J. Wong [Fri, 18 Aug 2017 20:52:28 +0000 (13:52 -0700)]
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>
6 years agoxfs: test for log recovery failure after tail overwrite
Brian Foster [Wed, 2 Aug 2017 16:36:13 +0000 (12:36 -0400)]
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>
6 years agooverlay: test mount error cases with index=on
Amir Goldstein [Tue, 15 Aug 2017 10:31:30 +0000 (13:31 +0300)]
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>
6 years agobtrfs/142: enhance regression test for nocsum dio read's repair
Lu Fengqi [Mon, 14 Aug 2017 07:03:13 +0000 (15:03 +0800)]
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>
6 years agobtrfs: test incremental send with compression and extent cloning
Filipe Manana [Thu, 10 Aug 2017 21:55:40 +0000 (22:55 +0100)]
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>
6 years agoxfs/424: add check for finobt && update comments
Xiao Yang [Fri, 4 Aug 2017 07:08:45 +0000 (15:08 +0800)]
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>
6 years agogeneric: test read around EOF
Zorro Lang [Thu, 3 Aug 2017 14:22:25 +0000 (22:22 +0800)]
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>
6 years agogeneric/307: add test to acl group
Ernesto A. Fernández [Wed, 9 Aug 2017 02:33:58 +0000 (23:33 -0300)]
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>
6 years agocommon/inject: refactor helpers to use new errortag interface
Darrick J. Wong [Fri, 4 Aug 2017 15:37:07 +0000 (08:37 -0700)]
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>
6 years agocommon/config: add acl and user_xattr support for TEST_DEV
Xiao Yang [Mon, 31 Jul 2017 09:36:56 +0000 (17:36 +0800)]
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>
6 years agocommon/config: unset TEST_FS_MOUNT_OPTS across config sections
Eryu Guan [Wed, 2 Aug 2017 13:49:00 +0000 (21:49 +0800)]
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>
6 years agofstests: remove tmp files properly
Eryu Guan [Wed, 11 Jan 2017 09:38:45 +0000 (17:38 +0800)]
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>
6 years agofstests: batch update of test file mode
Eryu Guan [Thu, 3 Aug 2017 04:18:20 +0000 (12:18 +0800)]
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>
6 years agocommon/xfs: add iomap_dio_actor() to the dmesg filter
Eryu Guan [Mon, 31 Jul 2017 04:16:33 +0000 (12:16 +0800)]
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>
6 years agogeneric/224: filter out expected XFS warnings for mixed direct/buffer I/O
Eryu Guan [Mon, 31 Jul 2017 03:42:10 +0000 (11:42 +0800)]
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>
6 years agonew: validate groups when creating new test
Eryu Guan [Fri, 28 Jul 2017 05:24:51 +0000 (13:24 +0800)]
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>
6 years agoext4: fsmap tests
Darrick J. Wong [Fri, 21 Jul 2017 22:04:39 +0000 (15:04 -0700)]
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>
6 years agoxfs: only run scrub in dry run mode
Darrick J. Wong [Fri, 21 Jul 2017 22:04:27 +0000 (15:04 -0700)]
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>
6 years agogeneric/449: make the test effective against xfs
Ernesto A. Fernández [Wed, 2 Aug 2017 04:19:34 +0000 (01:19 -0300)]
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>
6 years agosrc: include <sys/sysmacros.h> for major() and minor()
Eric Biggers [Sat, 29 Jul 2017 04:13:41 +0000 (21:13 -0700)]
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>
6 years agogeneric/446: make sure all background processes are dead before umount
Eryu Guan [Tue, 25 Jul 2017 08:04:21 +0000 (16:04 +0800)]
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>
6 years agoext4: add a test for ea_inode feature
Tahsin Erdogan [Wed, 26 Jul 2017 18:02:16 +0000 (11:02 -0700)]
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>
6 years agoxfs: test xfs_db to ensure type size taken into account with new type
Bill O'Donnell [Mon, 24 Jul 2017 15:07:49 +0000 (10:07 -0500)]
xfs: test xfs_db to ensure type size taken into account with new type

xfs_db should take type size into account when setting type.
If type size isn't updated whenever type is set, a false crc
error can occur due to the stale size. This test checks for
that false crc error.

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 agocommon/rc: factor out _ext4_disable_extent_zeroout() helper
Xiao Yang [Mon, 24 Jul 2017 10:44:31 +0000 (18:44 +0800)]
common/rc: factor out _ext4_disable_extent_zeroout() helper

1) This pattern is repeated in several seek_data/hole tests
   (e.g. generic/285, generic/436, generic/445 generic/448)
   and generic/009.  A common _ext4_disable_extent_zeroout()
   helper could be added and applied by generic/009 and
   _require_seek_data_hole().

2) On some old kernels(e.g. v3.1-v3.6), when vfs recognizes
   SEEK_DATA/HOLE flag && ext4 has no extent zeroout tunable
   in sysfs, these cases may trigger "sysfs entry not found"
   issue.  We can add check if extent_max_zeroout_kb exists
   on ext4 filesystem.
   The extent_max_zeroout_kb is introduced by:
   '67a5da564f97 ("ext4: make the zero-out chunk size tunable")'

3) Declare several vars as local in _require_seek_data_hole().

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/rc: support reiserfs in _scratch_mkfs_sized
Ernesto A. Fernández [Mon, 24 Jul 2017 04:02:35 +0000 (01:02 -0300)]
common/rc: support reiserfs in _scratch_mkfs_sized

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>
6 years agoxfs/068: update golden output due to new operations in fsstress
Zorro Lang [Tue, 18 Jul 2017 14:37:14 +0000 (22:37 +0800)]
xfs/068: update golden output due to new operations in fsstress

I added some new operatoins to fsstress, and it changed the total
number of test operstions.

xfs/068 use a fixed seed (-s) and number of operations (-n) to run
fsstress, to get fixed number of files and directories. Due to my
patches break these fixed things, so update its expected result in
golden image.

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 agofsstress: add AIO read/write and fsync test
Zorro Lang [Tue, 18 Jul 2017 14:37:13 +0000 (22:37 +0800)]
fsstress: add AIO read/write and fsync test

We found some bugs by aio read/write test, but there's no such
operations in fsstress. So add AIO test into fsstress to increase
AIO stress test.

Due to most kernels don't support aio fsync, so set its test
frequency to zero as default.

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 agofsstress: new writev and readv operations test
Zorro Lang [Tue, 18 Jul 2017 14:37:12 +0000 (22:37 +0800)]
fsstress: new writev and readv operations test

We found some bugs by writev operations recently, writev can cover
different test than normal write operation, so add writev and readv
operations into fsstress.

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 agoinclude: remove some unused headers
Eric Biggers [Fri, 21 Jul 2017 04:22:05 +0000 (21:22 -0700)]
include: remove some unused headers

test.h and usctest.h aren't used by anything.  Get rid of them.

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 agobuild: remove IRIX-specific build logic
Eric Biggers [Fri, 21 Jul 2017 04:22:05 +0000 (21:22 -0700)]
build: remove IRIX-specific build logic

As xfstests is no longer supported on IRIX, remove the ability to build
xfstests for IRIX.

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: remove IRIX-specific code
Eric Biggers [Fri, 21 Jul 2017 04:22:05 +0000 (21:22 -0700)]
common: remove IRIX-specific code

As xfstests is no longer supported on IRIX, remove IRIX-specific code
from the common helper scripts.

[eguan: add _filter_devchar back as xfs/061 needs it]

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 agotests: clean up per-OS output files
Eric Biggers [Fri, 21 Jul 2017 04:22:05 +0000 (21:22 -0700)]
tests: clean up per-OS output files

Some tests had separate output files for IRIX and Linux.  Now that the
IRIX ones have been removed, rename the Linux ones and remove the
now-unneeded .cfg files and calls to _link_out_file.

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 agotests: remove IRIX support from tests also supported on Linux
Eric Biggers [Fri, 21 Jul 2017 04:22:05 +0000 (21:22 -0700)]
tests: remove IRIX support from tests also supported on Linux

Many tests claimed (via _supported_os) to work on both Linux and IRIX.
Since IRIX is no longer supported by xfstests, update these to claim
Linux support only.  Then remove any obvious IRIX-specific logic in the
tests, and any IRIX-specific golden output files.

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 agoREADME: remove IRIX-specific documentation
Eric Biggers [Fri, 21 Jul 2017 04:22:05 +0000 (21:22 -0700)]
README: remove IRIX-specific documentation

xfstests is no longer supported on IRIX, so remove the IRIX-specific
instructions for building and running xfstests.

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 agotests: make shared/051 a generic test
Eric Biggers [Fri, 21 Jul 2017 04:22:05 +0000 (21:22 -0700)]
tests: make shared/051 a generic test

The ACL test shared/051 was very similar to generic/099 which was not
being run and was just removed; most likely the script was copy+pasted
at some point.  Since shared/051 has been getting maintained+run and is
not really XFS and UDF-specific, move it to generic, reusing the old
number of 099.  One change was required for it to work on other
filesystems: the output of 'find' must be sorted.

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 agotests: remove generic/099
Eric Biggers [Fri, 21 Jul 2017 04:22:04 +0000 (21:22 -0700)]
tests: remove generic/099

This IRIX-specific ACL test was nearly identical to shared/051, which
has been better maintained and will be made a generic test in the next
commit.  Therefore, remove the existing generic/099.

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 agotests: remove xfs/057 and xfs/058
Eric Biggers [Fri, 21 Jul 2017 04:22:04 +0000 (21:22 -0700)]
tests: remove xfs/057 and xfs/058

These two IRIX and XFS-specific tests were just placeholders which
didn't actually test anything.  It also seems they were meant to use the
acl_get and acl_test programs, but those weren't even being compiled.
Get rid of all this unused stuff.

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 agotests: remove xfs/114 and xfs/115
Eric Biggers [Fri, 21 Jul 2017 04:22:04 +0000 (21:22 -0700)]
tests: remove xfs/114 and xfs/115

These two IRIX and XFS-specific tests tested the "parent pointer"
feature which is not implemented by XFS on Linux.  Just remove them.

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 agotests: remove udf/101
Eric Biggers [Fri, 21 Jul 2017 04:22:04 +0000 (21:22 -0700)]
tests: remove udf/101

This IRIX and UDF-specific test essentially just created a UDF
filesystem with a specific size.  This isn't really useful because there
already are many generic tests that do _scratch_mkfs_sized.  So just
delete the test rather than trying to port it to Linux.

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 agotests: remove udf/098
Eric Biggers [Fri, 21 Jul 2017 04:22:04 +0000 (21:22 -0700)]
tests: remove udf/098

udf/098 was an IRIX and UDF-specific test which tested xattrs.  But the
Linux UDF driver doesn't support xattrs, and even if it did there are
already generic xattr tests --- including now generic/097 which is
basically the same test.  So just delete udf/098.

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 agotests: port xfs/095 to Linux
Eric Biggers [Fri, 21 Jul 2017 04:22:04 +0000 (21:22 -0700)]
tests: port xfs/095 to Linux

This tests upgrading the XFS log to v2.  Switch from the IRIX xfs_chver
program to xfs_db.

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 agotests: port generic/097 to Linux
Eric Biggers [Fri, 21 Jul 2017 04:22:04 +0000 (21:22 -0700)]
tests: port generic/097 to Linux

This IRIX-specific test did some basic testing of extended attributes.
Port it to Linux; this mainly involved updating it to use the 'getfattr'
and 'setfattr' programs instead 'attr'.  Note that although 'attr' is
available on Linux, it's mainly for IRIX compatibility, the man page
recommends against using it on non-XFS filesystems, and it doesn't
support listing user xattrs only.  (In the last point it actually
differs from IRIX 'attr', but probably no one cares anymore.)  getfattr
also sorts its output by xattr name, so its output will be the same on
all filesystems unlike 'attr -l'.

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 agotests: port generic/093 to Linux
Eric Biggers [Fri, 21 Jul 2017 04:22:04 +0000 (21:22 -0700)]
tests: port generic/093 to Linux

This IRIX-specific test mainly tested whether a file's capabilities are
cleared when it is written to.  Port the test to the Linux libcap tools
and update it to expect the Linux semantics which are a little simpler:
capabilities are always cleared even if the program is root (or has
CAP_FSETID).  The test also tests that chmod doesn't affect open file
descriptors; this is mostly unrelated, but keep it in for now.

[eguan: add _require_test_program rule for src/writemod]

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/192: use shorter sleep and tolerate 2s delay
Eric Biggers [Wed, 19 Jul 2017 22:25:08 +0000 (15:25 -0700)]
generic/192: use shorter sleep and tolerate 2s delay

generic/192 would sleep 40 seconds, update a file's atime, and then
fail if the atime was not exactly 40 seconds later.  This is
unreliable since things may be slow enough to cause an extra second
to elapse.  "Fix" this by allowing for 2 seconds of delay.  Also,
while we're at it shorten the sleep to a much more reasonable 5
seconds.

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/421: stop test from hanging on buggy kernels
Eric Biggers [Wed, 19 Jul 2017 20:35:51 +0000 (13:35 -0700)]
generic/421: stop test from hanging on buggy kernels

On some buggy kernels, the 'find' command in generic/421 encounters
a "Permission denied" error when trying to search $dir, so it
doesn't find the file it's supposed to.  This causes 'cat' to read
from stdin, hanging the test.  Quote the argument to cat to make the
test fail right away rather than hanging.

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: add a less thorough testing mode for fsync-err program
Jeff Layton [Mon, 17 Jul 2017 18:10:13 +0000 (14:10 -0400)]
generic: add a less thorough testing mode for fsync-err program

Currently we just have this test run on a whitelist of filesystems,
but it would be best to be able to run it on all of them. The
problem is that a lot of filesystems basically shut down once they
hit metadata errors.

Allow the fsync-err testcase to operate in two different modes. One
mode just does basic testing to ensure that we get an error back on
all fd's when we fsync. The other does a more thorough test to
ensure that we get back 0 on subsequent fsyncs when there hasn't
been any write activity.

For now, we just opt-in to the more thorough testing on certain
filesystems: xfs, ext3 and ext4 on the generic test. All other
filesystems will run in simple mode.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: add test of file mode when setfacl fails
Ernesto A. Fernández [Wed, 19 Jul 2017 05:51:50 +0000 (02:51 -0300)]
generic: add test of file mode when setfacl fails

Check that the group permission bits of a file are not altered when
setfacl fails. At the time of this patch the test fails for at least
ext2, ext4, jfs and btrfs.

The failure in setfacl is induced by filling the device and setting
as many user attributes to the file as possible. For xfs this is not
enough, and the test will not run.

[eguan replaced setfattr with $SETFATTR_PROG and added enospc 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>
6 years agocommon/attr: fix check for _require_attrs()
Ernesto A. Fernández [Wed, 19 Jul 2017 04:06:35 +0000 (01:06 -0300)]
common/attr: fix check for _require_attrs()

As of now xfstests decides if a filesystem supports attributes by trying
to write one to the mount point. For some reason this fails on reiserfs,
making it impossible to run tests that _require_attrs.

Fix this by checking against $TEST_DIR/syscalltest instead of $TEST_DIR.

This is probably what was intended, since the syscalltest file is touched
right before running attr. It is also consistent with how the check for
acl support is done.

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>
6 years agocommon/rc: support jfs in _scratch_mkfs_sized
Ernesto A. Fernández [Fri, 14 Jul 2017 22:06:19 +0000 (19:06 -0300)]
common/rc: support jfs in _scratch_mkfs_sized

Add support for jfs in _scratch_mkfs_sized. Fix the block size in
4096, which seems to be the only option in jfs_mkfs.

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>
6 years agobtrfs: test direct IO write against raid5/6 filesystems
Filipe Manana [Thu, 13 Jul 2017 14:10:40 +0000 (15:10 +0100)]
btrfs: test direct IO write against raid5/6 filesystems

Test that a direct IO write works against raid5/6 filesystems and that
after the write operation we are able to read back the correct data
and scrub operations don't find any errors.

This test is motivated by a regression introduced in the merge window
for the 4.13 linux kernel, which was undetected by the current set of
test cases. The issue is fixed by the following patch:

  "Btrfs: fix write corruption due to bio cloning on raid5/6"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric: test negative SEEK_HOLE/SEEK_DATA offsets
Darrick J. Wong [Thu, 13 Jul 2017 19:06:41 +0000 (12:06 -0700)]
generic: test negative SEEK_HOLE/SEEK_DATA offsets

Check that we get -ENXIO if the user calls SEEK_HOLE/SEEK_DATA with
a negative file offset.

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>
6 years agooverlay: enable the index feature for overlay/hardlink tests
Amir Goldstein [Wed, 12 Jul 2017 09:43:25 +0000 (12:43 +0300)]
overlay: enable the index feature for overlay/hardlink tests

Overlayfs hardlink test are expected to fail if overlayfs does not
support the inodes index feature, so don't un them if kernel does
not support the feature.

If the feature is supported, enable it with the index=on mount option
for the hardlink tests, regardless of the build time default determined
by kernel config option CONFIG_OVERLAY_FS_INDEX.

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 agofstests: add helper _require_scratch_feature
Amir Goldstein [Wed, 12 Jul 2017 09:43:24 +0000 (12:43 +0300)]
fstests: add helper _require_scratch_feature

The helper is used to test if a specific filesystem feature can
be enabled. Currently only implemented testing overlayfs features.

Overalyfs features (e.g. redirect_dir, index) are configurable from
Kconfig (the build default), by module parameter (the system default)
and per mount using the mount option ${feature}=[on|off].

The helper is going to be used by overlay tests, which depend
on the inodes index feature.

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: test mount error cases with exclusive directories
Amir Goldstein [Wed, 12 Jul 2017 12:07:59 +0000 (15:07 +0300)]
overlay: test mount error cases with exclusive directories

Overlayfs is often used to mount several mounts that share a single
lower dir, but every overlayfs mount should have its own private
upperdir and private workdir.

Overlayfs mount on kernel <= v4.12 does not check if upper/work dirs
are currently in-use by another overlayfs mount on the system and bad
things can happen with such configuration.

Expect EBUSY when trying to mount overlay when:
- Upper dir is in-use by another overlay mount
- Work dir is in-use by another overlay mount

This test does not depend on the overlay index feature.

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: test cases that force read-only mount
Amir Goldstein [Tue, 11 Jul 2017 19:52:05 +0000 (22:52 +0300)]
overlay: test cases that force read-only mount

Verify that overlay is mounted read-only and that it cannot
be remounted rw.

- Mount with no upper dir
- Failure to create work dir

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: create overlay/mount test group
Amir Goldstein [Tue, 11 Jul 2017 19:52:04 +0000 (22:52 +0300)]
overlay: create overlay/mount test group

Add tests overlay/022 and overlay/024 to overlay/mount test group.
These tests check behavior of overlay mount cases.

Cc: Xiong Zhou <xzhou@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/014: fix test with inodes index enabled
Amir Goldstein [Tue, 11 Jul 2017 19:52:03 +0000 (22:52 +0300)]
overlay/014: fix test with inodes index enabled

When overlayfs is configured with CONFIG_OVERLAY_FS_INDEX=y,
workdir from previous overlay mount cannot be reused in a new
overlay mount that uses a different upper dir.

Fix the test to use a different workdir when mounting with a
different upper dir.

This change has not effect on older kernels and overlay
configured without CONFIG_OVERLAY_FS_INDEX.

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/014: remove unneeded require and include
Amir Goldstein [Tue, 11 Jul 2017 19:52:02 +0000 (22:52 +0300)]
overlay/014: remove unneeded require and include

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 agoreflink: test unlinking a huge extent with a lot of refcount adjustments
Darrick J. Wong [Wed, 21 Jun 2017 21:57:48 +0000 (14:57 -0700)]
reflink: test unlinking a huge extent with a lot of refcount adjustments

Test a regression in XFS where we blow out a transaction reservation if
we create a big file, share every other block, and delete the first
file.  There's nothing particularly fs-specific about this stress test,
so put it in generic.

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>
6 years agoxfs/297: fail test if _scratch_mount fails
Brian Foster [Thu, 6 Jul 2017 18:06:20 +0000 (14:06 -0400)]
xfs/297: fail test if _scratch_mount fails

xfs/297 formats the scratch device with test specific mkfs options
that limit the use of certain mount options (i.e., if logbsize !=
256k). If an incompatible mount option is set, the mount fails but
the test proceeds to run against the root filesystem.

Update xfs/297 to fail if the mount of the scratch device fails for
whatever reason.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agogeneric/095, generic/247: unmount correct devices
Eric Biggers [Thu, 6 Jul 2017 05:31:36 +0000 (22:31 -0700)]
generic/095, generic/247: unmount correct devices

In commit d55123c080cb ("generic/247: filter out expected XFS warnings
for mixed mmap/direct I/O"), _scratch_unmount was removed from
generic/095 and added to generic/247.  But actually generic/095 *should*
be unmounting SCRATCH_DEV; and generic/247 should be unmounting
TEST_DEV, not SCRATCH_DEV, since it doesn't use a scratch device (it was
failing if SCRATCH_DEV was not defined).  Fix it.

[eguan: the original bug was introduced by me not Brian, as I
removed _scratch_unmount from wrong test]

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 agooverlay: test dropping nlink below zero
Amir Goldstein [Wed, 5 Jul 2017 12:02:06 +0000 (15:02 +0300)]
overlay: test dropping nlink below zero

nlink of overlay inode could be dropped indefinitely by adding
un-accounted lower hardlinks underneath a mounted overlay and
trying to remove them.

The simplest way to understand this test is this:
Imagine that you have a tool (e.g. xfs_db) with which you can add
hardlinks, without changing the value of nlink stored on-disk for
the inode. This is exactly what this test does when it adds lower
hardlinks underneath a mounted overlay.

Commit 5f8415d6b87e ("ovl: persistent overlay inode nlink for
indexed inodes") fixes this issue, although the issue was never
exposed in any released kernel.

With overlayfs indexed copy up and without the fix, the test
triggers WARN_ON(inode->i_nlink == 0) in drop_link().

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: test nlink accounting of overlay hardlinks
Amir Goldstein [Wed, 5 Jul 2017 12:02:05 +0000 (15:02 +0300)]
overlay: test nlink accounting of overlay hardlinks

nlink of overlay inode should account for the union of lower
and upper hardlinks.

persistent overlay union nlink is stored in an extended attribute
on the upper inode.

In order to test persistent overlay nlink accounting, the test is
repeated with both warm and cold dentry/inode cache.

[eguan: add comments on what fields report_nlink prints]

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: test concurrent copy up of lower hardlinks
Amir Goldstein [Wed, 5 Jul 2017 12:02:04 +0000 (15:02 +0300)]
overlay: test concurrent copy up of lower hardlinks

Two tasks make a modification concurrently on two hardlinks of a
large lower inode.  The copy up should be triggered by one of the
tasks and the other should be waiting for copy up to complete.  Both
copy up targets should end up being upper hardlinks and both
metadata changes should be visible in both hardlinks.

With kernel <= v4.12, hardlinks are broken on copy up, meaning that
copy up is performed independetly and the resulting upper copy up
targets each have only one of the the metadata changes visible.

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/018: test lower hardlinks re-unite on copy up
Amir Goldstein [Wed, 5 Jul 2017 12:02:03 +0000 (15:02 +0300)]
overlay/018: test lower hardlinks re-unite on copy up

Test that when two lower hardlinks are copied up, they end up
as two upper hardlinks of the same upper inode.

Drop caches before copy up so there is no knowledge of the
copied up hardlink in inode/dcache.

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/018: test broken hardlinks after mount cycle
Amir Goldstein [Wed, 5 Jul 2017 12:02:02 +0000 (15:02 +0300)]
overlay/018: test broken hardlinks after mount cycle

This test checks if overlayfs hardlinks are preserved across
copy up.  Check if they are preserved also after copy up and
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/018: print hardlink content to golden output
Amir Goldstein [Wed, 5 Jul 2017 12:02:01 +0000 (15:02 +0300)]
overlay/018: print hardlink content to golden output

diff may skip comparing content of files with identical st_ino/st_dev.
Overlayfs stat(2) may return same st_dev/st_ino for hardlink copy ups,
but it does not mean that read(2) will return the same content.

Convert the test to output hardlink files content to golden output
instead of using diff.

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/018: re-factor and add to hardlink group
Amir Goldstein [Wed, 5 Jul 2017 12:02:00 +0000 (15:02 +0300)]
overlay/018: re-factor and add to hardlink group

Use helpers to records and check inode numbers so we can repeat
the same test after each hardlink copy up and 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 agogeneric/446: add __xfs_get_blocks() into _filter_xfs_dmesg
Xiao Yang [Mon, 3 Jul 2017 07:35:59 +0000 (15:35 +0800)]
generic/446: add __xfs_get_blocks() into _filter_xfs_dmesg

On xfs filesystem, the following patch fixed system crash caused by
this race, but it introduced the __xfs_get_blocks() warning when the
race occurred:
04197b3 ("xfs: don't BUG() on mixed direct and mapped I/O")

On upstream kernel, the fix patch was cleared by:
acdda3a ("xfs: use iomap_dio_rw")

When the fix patch was applied and not cleared(e.g, on RHEL7.4),
this case triggered the __xfs_get_blocks() warning as expected.
Moreover, generic/095 may reproduce the same warning occasionally.
So we could add __xfs_get_blocks() into _filter_xfs_dmesg.

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 agoxfs: scrub while appending to a file
Darrick J. Wong [Wed, 21 Jun 2017 21:58:22 +0000 (14:58 -0700)]
xfs: scrub while appending to a file

It turns out that there was a bug in xfs_bmap_count_blocks wherein
the block count returned would count or not count delalloc blocks
depending on the fork format.  This is a bug that is easily exposed
via scrub, so check the output of that function here -- the buggy
version of the function produces online fsck errors.

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>
6 years agoext4: don't online scrub ever
Darrick J. Wong [Fri, 30 Jun 2017 04:58:12 +0000 (21:58 -0700)]
ext4: don't online scrub ever

The ext4 online scrub program is no longer under active development,
so remove all the test code that tried to use it.

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>
6 years agocommon/rc: test that the xfs_io scrub/repair commands actually work
Darrick J. Wong [Fri, 30 Jun 2017 04:12:39 +0000 (21:12 -0700)]
common/rc: test that the xfs_io scrub/repair commands actually work

When we call _require_xfs_io_command for the scrub ioctl, we have to
actually try calling the ioctl to make sure that the ioctl is
present on the running kernel.

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>
6 years agocommon/populate: remember multi-device configurations
Darrick J. Wong [Fri, 30 Jun 2017 04:12:04 +0000 (21:12 -0700)]
common/populate: remember multi-device configurations

Record the external log and realtime device configurations when we
create a sample filesystem.  ext4 tightly binds to external logs,
so we have to preserve that too.

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>
6 years agooverlay/031: add tests of whiteouts in lowerdir and both dirs
zhangyi (F) [Mon, 3 Jul 2017 10:43:31 +0000 (18:43 +0800)]
overlay/031: add tests of whiteouts in lowerdir and both dirs

In overlay/031, it only cover the test case of whiteouts in
origined upper dir. This patch add two cases cover the other
two situations:

1) Lower origined dir have whiteouts;
2) Both upper and lower origined dirs have whiteouts (although
this case is pass now, still add this to cover all three kinds
of situations).

Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agooverlay/031: factor out _create_whiteout() helper
zhangyi (F) [Fri, 30 Jun 2017 03:20:10 +0000 (11:20 +0800)]
overlay/031: factor out _create_whiteout() helper

Factor out helper for create an leftover whiteout,
this is common to repeat test of whiteout check in
different underlaying directories.

Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agoxfs: test freeze/rmap repair race
Darrick J. Wong [Wed, 21 Jun 2017 21:58:11 +0000 (14:58 -0700)]
xfs: test freeze/rmap repair race

The rmapbt repair code plays some dirty tricks with the fs freezer
to avoid running afoul of regular xfs locking requirements.  Add a
test to check that filesystem write activities do not deadlock with
the repair program.

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>
6 years agogeneric: test a race between dio reads and mapped writes
Xiao Yang [Thu, 29 Jun 2017 06:36:41 +0000 (14:36 +0800)]
generic: test a race between dio reads and mapped writes

This test reproduces a race between a direct I/O read and
a mapped write to a hole in a file.  On xfs filesystem, it
will trigger a BUG_ON(), and this XFS bug has been fixed by:

04197b3 ("xfs: don't BUG() on mixed direct and mapped I/O")

[ eguan: umount before check dmesg log, and add rw group ]

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 agoxfs/274: flip shared bits to reflect xfsprogs usage
Darrick J. Wong [Wed, 21 Jun 2017 21:57:20 +0000 (14:57 -0700)]
xfs/274: flip shared bits to reflect xfsprogs usage

xfs_io's fsmap command flipped the attrfork and shared bits, so we
have to change them here too.

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>
6 years agogeneric/247: filter out expected XFS warnings for mixed mmap/direct I/O
Brian Foster [Wed, 28 Jun 2017 14:14:42 +0000 (10:14 -0400)]
generic/247: filter out expected XFS warnings for mixed mmap/direct I/O

generic/247 reproduces some of the same, expected warnings from XFS
as generic/095. These warnings occur due to mixed buffered/mapped
I/O racing with direct I/O to the same file.

generic/095 contains a custom dmesg filter to prevent test failure
in the event of such warnings. Lift the helper from generic/095 to
common/xfs and reuse it in generic/247 to implement the same
behavior.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agocommon/rc: handle the case when syscall isn't available
Luis Henriques [Wed, 28 Jun 2017 11:20:51 +0000 (12:20 +0100)]
common/rc: handle the case when syscall isn't available

_require_xfs_io_command() isn't handling the case where the
requested syscall isn't available. To fix this simply check the
error returned by xfs_io.

Usually the userspace should be synced with kernelspace, the case
that a syscall is supported by userspace tool but not kernelspace
should not happen, but in rare test setups it's possible, e.g.
building an initramfs that contains the testing tools from a recent
distro, and running the tests against an old kernel (which does not
include such syscall).

[ eguan: it's not copy_file_range syscall specific issue, update
summary and commit log, and provide more background information ]

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 agobtrfs/027: reorder the arguments of btrfs replace
Lu Fengqi [Wed, 28 Jun 2017 05:45:31 +0000 (13:45 +0800)]
btrfs/027: reorder the arguments of btrfs replace

The option parser only accept options before non-option argument.
Although David Sterba has submitted commit df8c7225ba00 ("btrfs:
reorder arguments so that options come first"), but this case seems
to be left out.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
6 years agobtrfs: test incremental send after replacing directory with a file
Filipe Manana [Sun, 25 Jun 2017 23:13:39 +0000 (00:13 +0100)]
btrfs: test incremental send after replacing directory with a file

Test that an incremental send/receive operation works correctly after
moving some directory inode A, renaming a regular file inode B into the
old name of inode A and finally creating a new hard link for inode B at
directory inode A.

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

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

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>