]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/log
xfstests-dev.git
8 years agooverlay: truncate running binaries from lower and upper dirs
Eryu Guan [Mon, 25 Jul 2016 17:10:23 +0000 (01:10 +0800)]
overlay: truncate running binaries from lower and upper dirs

Test truncate running executable binaries from lower and upper dirs.
truncate(2) should return ETXTBSY, not other errno nor segfault

Commit 03bea6040932 ("ovl: get_write_access() in truncate") fixed
this issue.

Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
8 years agooverlay: remove stale file from upperdir
Eryu Guan [Mon, 25 Jul 2016 15:37:22 +0000 (23:37 +0800)]
overlay: remove stale file from upperdir

The upper dentry may become stale before we remove it from overlay,
e.g. file was removed from upperdir directly, which triggered
warning/oops in ovl_remove_and_whiteout().

Commit cfc9fde0b07c ("ovl: verify upper dentry in
ovl_remove_and_whiteout()") fixed this issue.

Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
8 years agooverlay: dump overlay private xattr
Eryu Guan [Mon, 25 Jul 2016 14:04:20 +0000 (22:04 +0800)]
overlay: dump overlay private xattr

Test dump overlay private xattr on overlayfs with multiple lower
dirs. All the lower layers, except the lowest one, should honor
overlay private xattr "trusted.overlay", which means it should not
be visible to user.

Commit b581755b1c56 ("ovl: xattr filter fix") fixed this issue.

Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
8 years agogeneric: run write(2) and fallocate(2) in parallel
Wang Xiaoguang [Mon, 25 Jul 2016 07:43:30 +0000 (15:43 +0800)]
generic: run write(2) and fallocate(2) in parallel

Currently in btrfs, there is something wrong with fallocate(2)'s
data space reservation, it'll temporarily occupy more data space
thant it really needs, which in turn will impact other operations'
data request.

In this test case, it runs write(2) and fallocate(2) in parallel and
the total needed data space for these two operations don't exceed
whole fs free data space, to see whether we will get any unexpected
ENOSPC error.

Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
8 years agoxfs/106: rewrite to make it a reliable regression test
Zorro Lang [Fri, 22 Jul 2016 10:24:06 +0000 (18:24 +0800)]
xfs/106: rewrite to make it a reliable regression test

xfs/106 is testing basic functions of xfs_quota command, but
there're three problems prevent people from running it as a reliable
regression test (i.e. it's not in 'auto' group):

- It tests unavailable commands in current xfs_quota, e.g. "warn"
- Lack of test coverage of important commands, e.g. "disable,
  enable, off and remove" commands
- Test output doesn't match golden image

So rewrite this case to test as many xfs_quota sub-commands and
options as possible and add it to 'auto' group, except:

- some "-v" options
- all "-a" options, because it's hard to get deterministic output
- default quota, this should be already covered by other tests
- project command options, I will write another case to test it
- report command -l option, which is a new option and will cause
  failure when testing with xfsprogs prior to 3.1 version.
- quot command -c option, which may output different histogram in
  different systems or hosts.
- warn command, which is not currently implemented.
- print, df, free, help, quit and path commands.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric/235: Fix false failures for some quota formats
Jan Kara [Thu, 21 Jul 2016 08:55:06 +0000 (10:55 +0200)]
generic/235: Fix false failures for some quota formats

Different quota format may print additional information in
repquota(8) output after standard quota information is printed. If
format does support this additional printouts, repquota(8) will
separate possible output by two empty lines even if format handler
doesn't actually printout anything (which is currently always the
case for queries test generic/235 does). If format doesn't support
additional printouts, these two empty lines are not present in the
output. This inconsistency causes false failures for some quota
formats.

Fix the problem by filtering out empty lines out of repquota(8)
output.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs: Update quick and auto tag for btrfs group
Qu Wenruo [Thu, 21 Jul 2016 08:13:15 +0000 (16:13 +0800)]
btrfs: Update quick and auto tag for btrfs group

Update the following quick/auto tag based on their execution time

btrfs/007
btrfs/050
btrfs/100
btrfs/101

Two systems are used to determine their execution time.  One is
backed by an SATA spinning rust, whose maximum R/W speed is about
100MB/s, modern desktop performance. (VM1)

Another one is a VM inside a openstack pool, with stronger CPU and
memory performance along with high latency storage.  Maximum R/W
speed is around 150MB/s, latency is much higher than normal HDD
though. (VM2)

The 'quick' standard is a little more restrict, only when both
systems pass the test within 30s(+/- 10%), while 'auto' is less
restrict, any system can pass within 5min(+/- 10%) will still stay
in 'auto' group.

Other test cases don't fit both standards on both systems will not
be modified.

Execution time result: (Unit: seconds)
------------------------------------------------------
Test case No. | VM1        | VM2      | Modification |
------------------------------------------------------
btrfs/007     | 4          | 2        | +quick       |
btrfs/050     | 4          | 13       | +quick       |
btrfs/100     | 57         | 151      | -quick       |
btrfs/101     | 45         | 59       | -quick       |
------------------------------------------------------

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agocommon/filter: Improve xfs_io filter
Jan Kara [Thu, 21 Jul 2016 06:15:19 +0000 (08:15 +0200)]
common/filter: Improve xfs_io filter

On my test setup xfs_io reports 'nan' in bytes/s and ops/s fields
when the operation takes zero time. Account for that in
_filter_xfs_io.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric/294: Filter backquotes from mknod error output
Jan Kara [Thu, 21 Jul 2016 06:17:35 +0000 (08:17 +0200)]
generic/294: Filter backquotes from mknod error output

Really old versions of coreutils (mine are 8.12) quote a filename in the
output with a backquote in the beginning and normal quote in the end.
Improve _filter_mknod to handle that.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric/075,112: fix up fsx error handling
Eric Sandeen [Tue, 19 Jul 2016 19:53:25 +0000 (12:53 -0700)]
generic/075,112: fix up fsx error handling

When fsx fails we try to copy failure state to the results/
dir, but in some cases we are using $seqres instead of
$seq or $seq instead of $here/$seq; fix this up so the
failure state is accurately captured in the results/ dir.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs: send on fully deduped file
Qu Wenruo [Tue, 19 Jul 2016 02:44:02 +0000 (10:44 +0800)]
btrfs: send on fully deduped file

For fully deduped file, whose file extents are all pointing to the
same extent, btrfs backref walk can be very time consuming, long
enough to trigger softlock.

Unfortunately, btrfs send is one of the caller of such backref walk
under an O(n) loop, making the total time complexity to O(n^3) or
more.

And even worse, btrfs send will allocate memory in such loop, to
trigger OOM on system with small memory(<4G).

This test case will check if btrfs send will cause these problems.

Reporeted-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoxfs/083: disable dmesg check
Xiao Yang [Tue, 12 Jul 2016 05:41:44 +0000 (13:41 +0800)]
xfs/083: disable dmesg check

xfs/083 will corrupt the fs intentionally, there will be WARNINGs
in dmesg as expected, so here disable dmesg check.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoxfs: Add mkfs input validation tests
Jan Tulak [Thu, 14 Jul 2016 12:43:34 +0000 (14:43 +0200)]
xfs: Add mkfs input validation tests

mkfs.xfs does not do a very good job of input validation. This test
is designed to exercise the input validation and test good/bad
combinations of options being set. It will not pass on an old
mkfs.xfs binary - it is designed to be the test case for an input
validation cleanup (merged in spring/summer 2016).

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agocheck: remove unused variable
Jan Tulak [Thu, 14 Jul 2016 12:43:31 +0000 (14:43 +0200)]
check: remove unused variable

After the previous patch moved few lines of code, one seqnum
assignment is now immediately overwritten by another. Remove the
useless one.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agocheck: fix extended names handling
Jan Tulak [Thu, 14 Jul 2016 12:43:30 +0000 (14:43 +0200)]
check: fix extended names handling

The code handling "./check foo/123", when the real test is
"foo/123-bar-baz" was moved to the earliest position, so everything
working with the test name or path will know the full name. Thus, no
"123" and "123-bar-baz" mix is possible.

An example of this issue is $testname.notrun file. When _notrun
"foo" was run during ./check foo/$name command, it created
$name.notrun. But few lines later, it wanted $fullname.notrun. So if
you did ./check foo/999, but the file was 999-bar-baz, then you got
comparing outputs (and most likely a fail) instead of a skip.

Another example of this mix is in xfstests output:
./check xfs/999
[...]
xfs/999 0s ... 0s
Ran: xfs/999-test-case

Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobuild: Fix installation for extended names
Jan Tulak [Mon, 11 Jul 2016 09:26:06 +0000 (11:26 +0200)]
build: Fix installation for extended names

xfstests supports extended test names like 314-foo-bar, but
installation of these tests was skipped (not matching a regexp). So
this patch fixes the makefiles in tests/*/

The include/buildrules change was written by Dave Chinner.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric/120: requires working *atime mount options
Christoph Hellwig [Mon, 18 Jul 2016 08:07:33 +0000 (11:07 +0300)]
generic/120: requires working *atime mount options

So call _require_atime to avoid spurious failures on NFS.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoxfs: fix wrong seq order in group file
Eryu Guan [Fri, 15 Jul 2016 04:59:21 +0000 (12:59 +0800)]
xfs: fix wrong seq order in group file

006 and 007 are in reverse order, and this breaks tools to find the
next available seq number in group file (e.g. tools/nextid).

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agocommon/rc: avoid mkfs option conflicts in _scratch_mkfs_xfs_supported
Eryu Guan [Fri, 15 Jul 2016 04:20:51 +0000 (12:20 +0800)]
common/rc: avoid mkfs option conflicts in _scratch_mkfs_xfs_supported

In recent mkfs.xfs updates in xfsprogs, commit 9090e187bc3e ("mkfs:
add respecification detection to generic parsing") added
re-specification detection to "-m" option, it causes several tests
_notrun if MKFS_OPTIONS has the same options as those being tested
in _scratch_mkfs_xfs_supported(), because they're specified multiple
times.

MKFS_OPTIONS="-m crc=0" ./check xfs/001
xfs/001 3s ... [not run] mkfs.xfs doesn't have crc feature

Fix it by creating XFS again without MKFS_OPTIONS in
_scratch_mkfs_xfs_supported(), in case there's conflict between
MKFS_OPTIONS and mkfs_opts, like what we do in _scratch_mkfs_xfs().

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric: add _require_block_device to more tests
Eryu Guan [Fri, 1 Jul 2016 03:08:41 +0000 (11:08 +0800)]
generic: add _require_block_device to more tests

generic/067 mounts $SCRATCH_DEV directly in the test, assuming it's
a block device. generic/299 and generic/300 query the size of
$SCRATCH_DEV by running 'blockdev --getsz $SCRATCH_DEV'.

So add the check to make sure $SCRATCH_DEV is a real block device in
these tests.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoxfs/096: run test only if mkfs.xfs accepts invalid inputs
Jan Tulak [Thu, 14 Jul 2016 12:43:33 +0000 (14:43 +0200)]
xfs/096: run test only if mkfs.xfs accepts invalid inputs

Because we recently changed how mkfs behaves when it gets
incorrect/invalid values, add a feature check to run this test only
on older binaries, which accepts invalid sunit values.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agocommon/rc: add _require_xfs_mkfs_validation
Jan Tulak [Thu, 14 Jul 2016 15:57:03 +0000 (17:57 +0200)]
common/rc: add _require_xfs_mkfs_validation

Add a simple way to skip a test if it is (or is not) run on mkfs
correctly validating inputs.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs: invalid rmdir issued by send operation
Filipe Manana [Sat, 2 Jul 2016 12:33:28 +0000 (13:33 +0100)]
btrfs: invalid rmdir issued by send operation

Test that an incremental send operation does not prematurely issues
rmdir operations under a particular scenario (the rmdir operation is
sent before the target directory is empty).

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

  "Btrfs: incremental send, fix premature rmdir operations"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs: incremental send after removing a directory
Filipe Manana [Sat, 2 Jul 2016 12:32:38 +0000 (13:32 +0100)]
btrfs: incremental send after removing a directory

Test that, under a particular scenario, an incremental send
operation does not leak memory (which used to emit a warning in
dmesg/syslog).

This is a regression test for a btrfs kernel fix that has the title:
"Btrfs: send, fix warning due to late freeing of orphan_dir_info
structures".

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs: incremental send after moving directories around
Filipe Manana [Sat, 2 Jul 2016 12:32:08 +0000 (13:32 +0100)]
btrfs: incremental send after moving directories around

Test that an incremental send operation works after doing radical
changes in the directory hierarchy that involve switching the inode
that directory entries point to.

This test exercises scenarios used to fail in btrfs and are fixed by
the following patches for the linux kernel:

 "Btrfs: send, fix failure to move directories with the same name around"
 "Btrfs: incremental send, fix invalid paths for rename operations"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs/079: Fix wrong value passed to available space check
Qu Wenruo [Mon, 11 Jul 2016 22:27:17 +0000 (15:27 -0700)]
btrfs/079: Fix wrong value passed to available space check

Wrong value is passed to _require_fs_space, which should be in unit
of kilobyte(1024), but passed in unit of gigabyte(1024^3).

Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoext4/021: add _require_metadata_journaling
Eric Whitney [Thu, 7 Jul 2016 20:12:02 +0000 (16:12 -0400)]
ext4/021: add _require_metadata_journaling

An ext4 file system can be created without a journal, but ext4/021
presumes it will contain one.  Make that requirement explicit to
avoid unnecessary failures when testing "nojournal" file systems.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoxfs: test clearing reflink inode flag
Darrick J. Wong [Fri, 17 Jun 2016 16:40:25 +0000 (09:40 -0700)]
xfs: test clearing reflink inode flag

Check that xfs_repair can clear the reflink inode flag.

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>
9 years agoxfs: inject errors at various parts of the deferred op completion
Darrick J. Wong [Fri, 17 Jun 2016 16:39:52 +0000 (09:39 -0700)]
xfs: inject errors at various parts of the deferred op completion

Use the error injection mechanism to test log recovery of deferred
work.

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>
9 years agoxfs/128: use $XFS_FSR_PROG instead of xfs_fsr directly
Darrick J. Wong [Fri, 17 Jun 2016 01:47:55 +0000 (18:47 -0700)]
xfs/128: use $XFS_FSR_PROG instead of xfs_fsr directly

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>
9 years agogeneric/204: increase log size for rmap/reflink
Darrick J. Wong [Fri, 17 Jun 2016 01:47:49 +0000 (18:47 -0700)]
generic/204: increase log size for rmap/reflink

We're going to need a bigger log for rmap & reflink on XFS, so
increase the size of the log and the fs appropriately.

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>
9 years agoxfs/229: require 3GB of space
Darrick J. Wong [Fri, 17 Jun 2016 01:47:24 +0000 (18:47 -0700)]
xfs/229: require 3GB of space

This test requires 3GB of space, so check for 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>
9 years agoxfs/235: fix logic errors when checking rmap usage after failures
Darrick J. Wong [Fri, 17 Jun 2016 01:47:17 +0000 (18:47 -0700)]
xfs/235: fix logic errors when checking rmap usage after failures

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>
9 years agoxfs/122: fix test output to reflect latest xfsprogs
Darrick J. Wong [Fri, 17 Jun 2016 01:46:58 +0000 (18:46 -0700)]
xfs/122: fix test output to reflect latest xfsprogs

Since we're getting rid of the rmapxbt, don't test for it.
Add back the log inode 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>
9 years agoxfs: configurable behavior on errors at unmount time
Zorro Lang [Tue, 5 Jul 2016 09:30:24 +0000 (17:30 +0800)]
xfs: configurable behavior on errors at unmount time

XFS used to retry forever on non-critical errors, and unmount could
hang in such case. Commit e6b3bb78962e ("xfs: add "fail at unmount"
error handling configuration") introduced an error configuration
option in sysfs(fail_at_unmount) and made this behavior
configurable.

Now test this "fail_at_unmount" behavior to make sure XFS doesn't
retry forever on error at unmount time, if configured so. Also
introduced new helpers to require/set/get sysfs attributes.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agocommon/dmerror: fix nonsensical arguments handling
Zorro Lang [Tue, 5 Jul 2016 09:30:23 +0000 (17:30 +0800)]
common/dmerror: fix nonsensical arguments handling

By default, _dmerror_load_*_table() suspends the dm device with
"--nolockfs" option. Callers have to feed two arguments to these
functions to change the behavior, with the second being 1, but the
first argument is not used at all, which doesn't make sense.

Fix it by checking if the first argument is "lockfs" and removing
"--nolockfs" option if so, or passing all options to dmsetup.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoquota: fix generic/244 on 32-bit platforms
Theodore Ts'o [Mon, 4 Jul 2016 14:09:48 +0000 (10:09 -0400)]
quota: fix generic/244 on 32-bit platforms

The test program src/test-nextquota.c relies on atoi() to convert a
string to an *unsigned* int.  If the string represents an integer
which is greater than INT_MAX, it is undefined how atoi(3) works,
and it turns out that:

       uint id = atoi("2147483649");

results in id == 2147483649 on x86_64, and id == 2147483647 on a
32-bit x86 platform.

So use strtoul(3) instead, which is portable and technically correct

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs: EDQUOTA leaks reserved data space
Qu Wenruo [Tue, 28 Jun 2016 01:54:51 +0000 (09:54 +0800)]
btrfs: EDQUOTA leaks reserved data space

When btrfs hits EDQUOTA when reserving data space, it will leak
already reserved data space.

This test case will check it by using more restrict enospc_debug
mount option to trigger kernel warning at umount time.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs: test RAID5 device reappear and balance
Anand Jain [Thu, 30 Jun 2016 10:59:14 +0000 (18:59 +0800)]
btrfs: test RAID5 device reappear and balance

The test does the following:
Initialize a RAID5 with some data

Re-mount RAID5 degraded with _dev3_ missing and write data.
Save md5sum checkpoint1

Re-mount healthy RAID5

Let balance fix degraded blocks.
Save md5sum checkpoint2

Re-mount RAID1 degraded now with _dev1_ missing.
Save md5sum checkpoint3

Verify if all three md5sum matches

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs: test RAID1 device reappear and balance
Anand Jain [Thu, 30 Jun 2016 10:58:21 +0000 (18:58 +0800)]
btrfs: test RAID1 device reappear and balance

The test does the following:
  Initialize a RAID1 with some data

  Re-mount RAID1 degraded with _dev1_ and write up to
  half of the FS capacity
  Save md5sum checkpoint1

  Re-mount healthy RAID1

  Let balance re-silver.
  Save md5sum checkpoint2

  Re-mount RAID1 degraded with _dev2_
  Save md5sum checkpoint3

  Verify if all three md5sum match

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs: add helper function to check if btrfs is module
Anand Jain [Wed, 15 Jun 2016 08:47:54 +0000 (16:47 +0800)]
btrfs: add helper function to check if btrfs is module

We need btrfs to be a module so that it can unloaded and reloaded,
so that we can clean up the btrfs internal in memory device list.

This patch adds _require_btrfs_unloadable() and _reload_btrfs_ko()
to help with the same.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs/027: make use of new device get and put helper functions
Anand Jain [Tue, 17 May 2016 14:32:07 +0000 (22:32 +0800)]
btrfs/027: make use of new device get and put helper functions

Below patches added helper function to get the requested
number of devices for scratch and spare device

btrfs: add functions to get and put a device for replace target
btrfs: add functions to set and reset required number of SCRATCH_DEV_POOL

This patch makes use of them.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs: add functions to get and put a device for replace target
Anand Jain [Thu, 23 Jun 2016 13:28:13 +0000 (21:28 +0800)]
btrfs: add functions to get and put a device for replace target

For the replace tests we need a device as a spare device,
here functions _spare_dev_get() and _spare_dev_put()
will get it from the SCRATCH_DEV_POOL_SAVED, which is set
when _scratch_dev_pool_get() is called, and is based on how
many has already been assigned to SCRATCH_DEV_POOL.

 usage:
   _scratch_dev_pool_get 3
   _spare_dev_get

      SPARE_DEV will have a device set which can be
      used as the replace target device.

   _spare_dev_put
   _scratch_dev_pool_put

_spare_dev_get() will pick the next device after SCRATCH_DEV_POOL
devices, from the SCRATCH_DEV_POOL_SAVED, and assigns it to
SPARE_DEV. _spare_dev_put() will set to SPARE_DEV to null.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs: add functions to set and reset required number of SCRATCH_DEV_POOL
Anand Jain [Thu, 23 Jun 2016 13:25:39 +0000 (21:25 +0800)]
btrfs: add functions to set and reset required number of SCRATCH_DEV_POOL

This patch provides functions
 _scratch_dev_pool_get()
 _scratch_dev_pool_put()

Which will help to set/reset SCRATCH_DEV_POOL with the required
number of devices. SCRATCH_DEV_POOL_SAVED will hold all the devices.

Usage:
  _scratch_dev_pool_get() <ndevs>
  :: do stuff

  _scratch_dev_pool_put()

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoxfs: test for post umount readahead completion panic
Brian Foster [Thu, 30 Jun 2016 12:49:34 +0000 (08:49 -0400)]
xfs: test for post umount readahead completion panic

XFS has a bug where directory readahead completions can occur after
unmount. This can lead to a crash or panic because metadata read
verification attempts to access core XFS data structures (e.g., the
log) after they have been freed and certain pointers have been
reset.

Add a test that triggers directory readahead, delays the readahead
I/O and immediately unmounts the filesystem. This test is part of
the dangerous group as it will cause kernels affected by the bug to
crash.

[eguan replaced touch with echo to speedup file creation]

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agocommon: support dm-delay to introduce I/O delays
Brian Foster [Thu, 30 Jun 2016 12:49:33 +0000 (08:49 -0400)]
common: support dm-delay to introduce I/O delays

Add some infrastructure in common/dmdelay to support use of the
dm-delay device-mapper module within tests. This is effectively
copied from the existing infrastructure in common/dmflakey. This
provides the ability to delay I/O. It only supports delaying read
I/O as that is all that is required at this point in time.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agooverlay: remove dir which contains whiteout from lower dir
Eryu Guan [Wed, 29 Jun 2016 10:39:12 +0000 (18:39 +0800)]
overlay: remove dir which contains whiteout from lower dir

Test the removal of a dir which contains whiteout from lower dir,
which could crash the kernel.

The following kernel commit fixed this issue
84889d4 ovl: check dentry positiveness in ovl_cleanup_whiteouts()

Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agooverlay: dentry leak for default_permissions mount option
Eryu Guan [Wed, 29 Jun 2016 06:11:25 +0000 (14:11 +0800)]
overlay: dentry leak for default_permissions mount option

overlayfs was leaking dentry on non-directories when using the
'default_permissions' mount option, which resulted in "BUG Dentry
still in use".

The following kernel commit fixed it:
ovl: fix dentry leak for default_permissions

Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric/042: remove from quick group
Christoph Hellwig [Thu, 30 Jun 2016 07:03:58 +0000 (09:03 +0200)]
generic/042: remove from quick group

This test has been removed from the auto group because it fails without
an expected fix.  Remove it from the quick group as well, as the quick
group should be a subset of the auto group.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs/048: extend _filter_btrfs_prop_error to handle additional errors
Jeff Mahoney [Mon, 27 Jun 2016 20:14:11 +0000 (16:14 -0400)]
btrfs/048: extend _filter_btrfs_prop_error to handle additional errors

btrfsprogs v4.5.3 changed the formatting of some error messages.
This patch extends the filter for btrfs prop to handle those.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric: Add richacl tests
Andreas Gruenbacher [Tue, 28 Jun 2016 12:47:26 +0000 (14:47 +0200)]
generic: Add richacl tests

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agofstests: Add / use _require_runas and _runas
Andreas Gruenbacher [Mon, 27 Jun 2016 22:40:21 +0000 (00:40 +0200)]
fstests: Add / use _require_runas and _runas

Add _require_runas and _runas functions instead of open-coding it in
test cases.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric/082: rename _filter_project_quota to a avoid function name conflict
Theodore Ts'o [Wed, 29 Jun 2016 13:20:58 +0000 (09:20 -0400)]
generic/082: rename _filter_project_quota to a avoid function name conflict

Commit 8469a8c1: "xfs/133-4: filter redundant projid 0 quota report
info out" added _filter_project_quota to common/filter, and this
conflicted with a _filter_project_quota function in generic/082.  So
rename the function in generic/082 to avoid the conflict.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agocommon/rc: ext4 doesn't support O_DIRECT with encryption
Theodore Ts'o [Wed, 29 Jun 2016 01:32:55 +0000 (21:32 -0400)]
common/rc: ext4 doesn't support O_DIRECT with encryption

Teach _require_odirect to skip the O_DIRECT tests if the ext4 mount
option "test_dummy_encryption" is enabled, since O_DIRECT doesen't
make sense when file system level encryption is enabled, and several
tests which use O_DIRECT --- ext4/301, ext4/304, generic/250 and
generic/252 --- fail when encryption is enabled.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric/294: filter quotes from mknod
Omer Zilberberg [Mon, 27 Jun 2016 12:53:28 +0000 (15:53 +0300)]
generic/294: filter quotes from mknod

Since coreutils v8.25, mknod errors omit quotes around filenames,
and this breaks generic/294's golden image.

Checked on Ubuntu 16.04.

See coreutils: 08e8fd7 all: avoid quoting file names when possible
https://github.com/coreutils/coreutils/commit/08e8fd7e38f2dae7c69c54eb22d508b6517e66e5

Signed-off-by: Omer Zilberberg <omzg@plexistor.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoext4/271: _notrun if there are journal related mount options
Eryu Guan [Thu, 23 Jun 2016 06:09:47 +0000 (14:09 +0800)]
ext4/271: _notrun if there are journal related mount options

ext4/271 runs in no journal mode (-onoload), so running test with
journal related mount options makes no sense, and test fails after
kernel commit 1e381f60dad9 ("ext4: do not allow journal_opts for fs
w/o journal"), journal related mount options are not allowed in no
journal mode. So _notrun if there're journal related mount options.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agofstests: introduce _exclude_scratch_mount_option helper
Eryu Guan [Thu, 23 Jun 2016 06:09:46 +0000 (14:09 +0800)]
fstests: introduce _exclude_scratch_mount_option helper

Some tests require that there's no certain mount option in
MKFS_OPTIONS, so introduce a new helper
_exclude_scratch_mount_option() to do the check on $MOUNT_OPTIONS.

Also convert generic/192 and xfs/134 to use this helper.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs/006: ignore btrfs filesystem sync stdout output
Anand Jain [Thu, 23 Jun 2016 13:17:29 +0000 (21:17 +0800)]
btrfs/006: ignore btrfs filesystem sync stdout output

btrfs fi sync /mnt, now does not output anything for success,
so the 006.out should be updated.

This change in btrfs-progs was introduced in the commit
 b005ca024990569d2de459485682158633937928
   btrfs-progs: fi sync: make it silent by default
 which was integrated at btrfs-progs version v4.5.2

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agooverlay: create new file over whiteout
Eryu Guan [Wed, 22 Jun 2016 11:38:58 +0000 (19:38 +0800)]
overlay: create new file over whiteout

Create file/dir over whiteout by another user, uid/gid of the
file/dir should be current fsuid/fsgid, not the mounter's.

This upstream kernel patch fixed the issue
d0e13f5 ovl: fix uid/gid when creating over whiteout

Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agooverlay: getcwd() after a failed rmdir
Eryu Guan [Wed, 22 Jun 2016 11:38:57 +0000 (19:38 +0800)]
overlay: getcwd() after a failed rmdir

Test getcwd() failure after unsuccessful rmdir, the getcwd() call
should return the correct path.

Upstream commit ce9113bbcbf4 ("ovl: fix getcwd() failure after
unsuccessful rmdir") fixed this issue.

Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agooverlay: test visible whiteout issue after rename
Eryu Guan [Wed, 22 Jun 2016 11:38:56 +0000 (19:38 +0800)]
overlay: test visible whiteout issue after rename

Test visible whiteout issue after renaming file from lowerdir to a
dir in upperdir.

Upstream commit 45d117389696 ("ovl: ignore lower entries when
checking purity of non-directory entries") fixed the issue

Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric/026: This test doesn't require runas
Andreas Gruenbacher [Tue, 31 May 2016 20:18:50 +0000 (22:18 +0200)]
generic/026: This test doesn't require runas

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agodmthin: express low_water in cluster_size not sector size
Eryu Guan [Fri, 17 Jun 2016 10:54:28 +0000 (18:54 +0800)]
dmthin: express low_water in cluster_size not sector size

I noticed that thin-pool sent out "reached low water mark for data
device" event even before thin-pool device was mounted in
generic/347, this is because low water mark was set to a too high
value.

According to kernel thin-provisioning.txt documentation, low water
mark should be expressed in blocks of $cluster_size, not in sectors.

"$low_water_mark is expressed in blocks of size $data_block_size."

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoxfs/186: run test on expected XFS configuration
Eryu Guan [Tue, 21 Jun 2016 10:56:37 +0000 (18:56 +0800)]
xfs/186: run test on expected XFS configuration

Usually xfs/186 _notrun on crc enabled XFS because of
_require_attr_v1, since v2 attr format is always enabled on v5 XFS.

But when testing on 512B block size XFS, i.e. MKFS_OPTIONS="-m crc=0
-b size=512", test fails. This is because crc enabled XFS was
created in the end, not 512B block size XFS with crc disabled, and
that's not what we want to test.

The reason why _scratch_mkfs_xfs creates a different XFS than
expected is that, it may ignore $MKFS_OPTIONS if mkfs fails due to
conflicts between $MKFS_OPTIONS and the provided mkfs options.

In the case of xfs/186, "-b size=512" conflicts with "-i size=512",
and the first mkfs fails, then it ends up with a 4k block size XFS
with crc enabled (the default config).

Fix it by checking crc enablement status and attr version in the
test, to make sure it's testing on expected XFS.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoxfs/186: fix test for crc=0, ftype=1
Eric Sandeen [Fri, 17 Jun 2016 17:54:43 +0000 (12:54 -0500)]
xfs/186: fix test for crc=0, ftype=1

Test 186 won't run when crcs are enabled, because
attrv1 is not allowed with crc=1.

However, ftype is still allowed with crc=0, so
this creates v3 directories, and xfs_db prints
them as such (along with the filetype), which
breaks the test output.

We can filter & replace to fix up the test in
this case.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agofstests: support check for uuidgen utility
Brian Foster [Thu, 16 Jun 2016 12:28:48 +0000 (08:28 -0400)]
fstests: support check for uuidgen utility

A recent test uses the uuidgen utility to generate UUID-based
filenames, but this package is not necessarily installed as part of
the core packages of every distro.

As such, add the UUIDGEN_PROG environment variable to the common
configuration and update the test to require the existence of
uuidgen to run.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs: qgroup handling on data extents balance
Qu Wenruo [Tue, 14 Jun 2016 09:26:27 +0000 (17:26 +0800)]
btrfs: qgroup handling on data extents balance

Btrfs after v4.2 kernel will leaks qgroup numbers for relocated data
extents, due to the design of tree block direct swap.

This test case will check if such data balance will corrupt qgroup.

Reported-by: Mark Fasheh <mfasheh@suse.de>
Reported-by: Filipe Manana <fdmanana@gmail.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric: check remount on I/O errors
Eryu Guan [Mon, 13 Jun 2016 16:32:40 +0000 (00:32 +0800)]
generic: check remount on I/O errors

XFS had a bug to hang on remount in this case, this kernel commit
fix the issue.

5cb13dc cancel the setfilesize transation when io error happen

Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric: check symlink to very long path
Eryu Guan [Mon, 13 Jun 2016 13:49:25 +0000 (21:49 +0800)]
generic: check symlink to very long path

Test symlink to very long path, so that path could not be hold in
inode, then check symlink file contains correct path.

There was a bug in CRC XFS, that the path in remote symlink was not
correct, this issue is fixed by this kernel commit

2ac56d3 xfs: fix remote symlinks on V5/CRC filesystems

Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoext4: regression test for fsync transaction ids initialization
Wang Xiaoguang [Wed, 15 Jun 2016 06:37:10 +0000 (14:37 +0800)]
ext4: regression test for fsync transaction ids initialization

Commit 688f869 fixed this bug:
    ext4: Initialize fsync transaction ids in ext4_new_inode()

We manually modify jbd2 journal_superblock_s.s_sequence to be a very
large number, which will greatly reduce the time taken to trigger
this bug, though it seems some too hacked.

Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoshared: check corrupted orphaned inode list handling
Guangwen Feng [Wed, 15 Jun 2016 05:21:31 +0000 (13:21 +0800)]
shared: check corrupted orphaned inode list handling

Commit c9eb13a fixed this bug:
ext4: fix hang when processing corrupted orphaned inode list

Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobtrfs: check qgroup on extent de-reference
Lu Fengqi [Tue, 14 Jun 2016 01:42:39 +0000 (09:42 +0800)]
btrfs: check qgroup on extent de-reference

Test if qgroup can handle extent de-reference during reallocation.
"extent de-reference" means that reducing an extent's reference
count or freeing an extent.

Although current qgroup can handle it, we still need to prevent any
regression which may break current qgroup.

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>
9 years agofstests: add _require_command check to killall
Masayoshi Mizuma [Mon, 13 Jun 2016 02:58:01 +0000 (11:58 +0900)]
fstests: add _require_command check to killall

Some tests use killall command, but killall may not exist.
We should check whether killall exists or not.

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoxfs/122: don't break on old xfsprogs
Darrick J. Wong [Tue, 31 May 2016 16:43:52 +0000 (09:43 -0700)]
xfs/122: don't break on old xfsprogs

If we're running against a old version of xfsprogs that lacks some
of the structures that the golden output knows about, copy the
structure size definition from the golden output to the program
output.  This way we can check for structure size mutations on old
xfsprogs without generating false error reports for structs that
don't exist in the old release.

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>
9 years agoreflink: change block sharing with constant refcount
Darrick J. Wong [Thu, 26 May 2016 05:57:49 +0000 (22:57 -0700)]
reflink: change block sharing with constant refcount

Ensure that we can handle the case where the refcount stays the same
even though the actual sharers changes.

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>
9 years agoxfs: map multiple bmbt records to a single rmapbt record
Darrick J. Wong [Fri, 27 May 2016 03:28:51 +0000 (20:28 -0700)]
xfs: map multiple bmbt records to a single rmapbt record

Make sure that we can handle multiple bmbt records mapping to a
single rmapbt record.  This can happen if you fallocate more than
2^21 contiguous blocks to a file.

(Also add some helpers that can create huge devices with some
dm-zero and dm-snapshot fakery.)

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>
9 years agoreflink: avoid reflink on swap files
Darrick J. Wong [Thu, 26 May 2016 05:57:36 +0000 (22:57 -0700)]
reflink: avoid reflink on swap files

Since none of the current filesystems support reflinked swap files,
make sure that we prohibit reflinking of swapfiles and swapon of
reflinked files.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoxfs: check accounting during refcountbt expansion
Darrick J. Wong [Thu, 26 May 2016 05:57:29 +0000 (22:57 -0700)]
xfs: check accounting during refcountbt expansion

Ensure that refcountbt allocations during truncate operations come
from the per-AG reservation and are not charged to the transaction.

Reported-by: Christoph Hellwig <hch@lst.de>
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>
9 years agoxfs: recover copy-on-write leftover
Darrick J. Wong [Thu, 26 May 2016 05:57:23 +0000 (22:57 -0700)]
xfs: recover copy-on-write leftover

Test recovery of CoW leftovers in xfs_repair.

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>
9 years agogeneric: don't put loop control files on the scratch mount
Darrick J. Wong [Fri, 27 May 2016 03:28:05 +0000 (20:28 -0700)]
generic: don't put loop control files on the scratch mount

If we're doing write/overwrite/snapshot/resource exhaustion tests on
the scratch device, use the test directory to hold the loop
termination signal files.  This way we don't run infinitely because
we can't create the flag due to ENOSPC.

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>
9 years agoxfs/104: don't enospc when ag metadata overhead grows
Darrick J. Wong [Thu, 26 May 2016 05:57:08 +0000 (22:57 -0700)]
xfs/104: don't enospc when ag metadata overhead grows

Adapt to different metadata overhead sizes by trying to reserve
decreasing amounts of disk space until we actually succeed at it.

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>
9 years agogeneric/131: dynamically allocate tcp listen port to avoid port clashes
Tahsin Erdogan [Wed, 8 Jun 2016 18:52:41 +0000 (11:52 -0700)]
generic/131: dynamically allocate tcp listen port to avoid port clashes

Current port selection algorithm is bound to have port clashes. To
eliminate clashes, let server pick an unused port and report it on
stdout.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoshared/272: don't try to use O_DIRECT
Theodore Ts'o [Thu, 9 Jun 2016 18:42:31 +0000 (14:42 -0400)]
shared/272: don't try to use O_DIRECT

A comment in shared/272 claims that ext4 supports O_DIRECT in
data=journalling mode.  Actually, it doesn't, it was just silently
ignoring O_DIRECT, let's not try to test O_DIRECT for either ext3 or
ext4 in this test.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric: mark tests that require O_DIRECT
Theodore Ts'o [Thu, 9 Jun 2016 18:42:08 +0000 (14:42 -0400)]
generic: mark tests that require O_DIRECT

generic/094 and generic/225 use fiemap-tester, which requires
O_DIRECT.

generic/311 requests fsync-tester to use O_DIRECT.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agodefrag: test $TEST_DEV for extents for ext4 defrag
Theodore Ts'o [Thu, 9 Jun 2016 18:41:09 +0000 (14:41 -0400)]
defrag: test $TEST_DEV for extents for ext4 defrag

Commit 902223bdbbf2: "defrag: require extents support for ext4
defrag" added a test to make sure the ext4 file system has extents
enabled by testing the scratch device.  Unfortunately at the time
when _require_defrag is run, the scratch file system hasn't been
initialized yet by the test, so its contents are undefined.

If the previous test explicitly creates a file system with extents
disabled on $SCRATCH_DEV (such as ext4/306), then subsequent tests
(e.g., ext4/307 and ext4/306) will refuse to run.

Fix this by testing $TEST_DEV instead of $SCRATCH_DEV.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric/186-7: fix unreferenced variables
Christoph Hellwig [Wed, 8 Jun 2016 18:17:31 +0000 (20:17 +0200)]
generic/186-7: fix unreferenced variables

There is not i variable in scope, and the comments suggest the
operation is to be done on ${file}.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric/015,274: add to the 'enospc' group
Wang Xiaoguang [Mon, 6 Jun 2016 10:25:30 +0000 (18:25 +0800)]
generic/015,274: add to the 'enospc' group

From test purpose,both two test cases belong to 'enospc' group.

Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoxfs: discontiguous multi-block buffer logging test
Brian Foster [Thu, 2 Jun 2016 13:10:01 +0000 (09:10 -0400)]
xfs: discontiguous multi-block buffer logging test

XFS had a bug in the multi-block buffer logging code that caused a
NULL lv panic at log push time due to invalid regions being set in
the buffer log format bitmap. This was demonstrated by modifying a
multi-block directory buffer in a manner that only logs regions
beyond the first FSB-sized mapping of the buffer.

To recreate these conditions, this test fragments free space and
populates several directories with enough entries to require
discontiguous multi-block buffers. To recreate the problem, we
remove entries from the tail end of the directory and fsync to flush
the log.

Note that this test causes a panic on kernels affected by the bug.
As such, it is included in the 'dangerous' group. The bug is
resolved by kernel commit a3916e528b91 ("xfs: fix broken multi-fsb
buffer logging").

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric/346: add to the quick and rw groups
Christoph Hellwig [Wed, 1 Jun 2016 12:38:26 +0000 (14:38 +0200)]
generic/346: add to the quick and rw groups

The test runs quickly and covers code not covered by any other test,
so add it to the quick group. Also add it to the rw group while
we're at it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agooverlay: test memleak in copy-up error handling path
Xiong Zhou [Fri, 27 May 2016 06:13:00 +0000 (14:13 +0800)]
overlay: test memleak in copy-up error handling path

This memleak leads to panic when unmount the underlying fs.
Kernel commit ab79efab0 fixed this issue.

Signed-off-by: Xiong Zhou <xzhou@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric: clear of suid/sgid on direct write
Eryu Guan [Thu, 26 May 2016 05:59:48 +0000 (13:59 +0800)]
generic: clear of suid/sgid on direct write

Check that suid/sgid bits are cleared on direct write. XFS triggered
WARN_ON_ONCE in this case. Patchset from Jan Kara fixed the warning:

http://oss.sgi.com/archives/xfs/2014-12/msg00071.html

This test is inspired by a test case from Eric Sandeen, and follows
the test steps in generic/193. This test requires direct I/O, it's
not added to generic/193 but to a new test, so that generic/193
still runs on filesystems don't have direct I/O support.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric/250: ignore xfs_io IO errors when writing to dmerror device
Eryu Guan [Thu, 26 May 2016 03:26:24 +0000 (11:26 +0800)]
generic/250: ignore xfs_io IO errors when writing to dmerror device

When testing with data=journal ext4, direct write to dmerror device
doesn't return EIO, because ext4 turns direct write to buffered
write in data=journal mode and all data is written to journal
buffer. The write only fails later when commiting journal and error
messages can be seen in dmesg.

As the test is checking on the md5 checksum of the test file, it's
ok to ignore the IO error returned by xfs_io, as long as the
checksums match the golden image.

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoxfs: filter stripe width details from repair
Eric Sandeen [Thu, 19 May 2016 21:19:51 +0000 (16:19 -0500)]
xfs: filter stripe width details from repair

Several golden outputs have:

> Note - stripe unit (0) and width (0) fields have been reset.

but it's entirely possible for this to be non-zero,
which then fails to match and fails the test.

Filter this repair output and fix the golden files.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agocommon/rc: teach _require_xfs_io_command accept multi-parameters
Zorro Lang [Thu, 19 May 2016 04:30:59 +0000 (12:30 +0800)]
common/rc: teach _require_xfs_io_command accept multi-parameters

The $param can't be used for all command's options, for example
"help pwrite" include:

 -Z N -- zeed the random number generator (used when writing randomly)
         (heh, zorry, the -s/-S arguments were already in use in pwrite)

We should make param="-Z N", not only "-Z". After this patch, we can
run this function as:

  _require_xfs_io_command pwrite -Z N

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agodmerror: exclude dmerror tests with mount -o dax
Eric Sandeen [Thu, 19 May 2016 21:12:22 +0000 (16:12 -0500)]
dmerror: exclude dmerror tests with mount -o dax

Same as we do for dm flakey. dm can't do dax.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agobuild: avoid struct fsxattr redefinition
Jeffrey Bastian [Wed, 18 May 2016 17:40:54 +0000 (12:40 -0500)]
build: avoid struct fsxattr redefinition

Linux kernel v4.5 defines 'struct fsxattr' in linux/fs.h [0] but
it's still defined in xfs/linux.h as a backup [1].  If the files are
included in the wrong order, the compiler will complain with a
redefinition error.  This patch moves linux/fs.h (and linux/magic.h)
before the xfs headers for the t_immutable.c and fsstress.c tests.

[0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=334e580a6f97e
[1] http://oss.sgi.com/cgi-bin/gitweb.cgi?p=xfs/cmds/xfsprogs.git;a=blob;f=include/linux.h;h=cc0f70ceed72#l183

Signed-off-by: Jeffrey Bastian <jbastian@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric: Test handling of private file mappings
Jan Kara [Thu, 12 May 2016 09:30:27 +0000 (11:30 +0200)]
generic: Test handling of private file mappings

Test handling of private file mappings in the kernel. Check that
writes of only one thread / process are seen in each page and that
none of these make it into the original file.

Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric: check fiemap SHARED flag on sync
Qu Wenruo [Mon, 16 May 2016 01:14:15 +0000 (09:14 +0800)]
generic: check fiemap SHARED flag on sync

The test case will check SHARED flag returned by fiemap ioctl on
reflinked files before and after sync.

Normally SHARED flag won't change just due to a normal sync
operation.

But btrfs doesn't handle SHARED flag well, and this time it won't
check any delayed extent tree(reverse extent searching tree)
modification, but only metadata already committed to disk.

So btrfs will not return correct SHARED flag on reflinked files if
there is no sync to commit all metadata.

This testcase will just check it.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agogeneric: extent map search on dedupe file
Qu Wenruo [Mon, 23 May 2016 09:16:21 +0000 (17:16 +0800)]
generic: extent map search on dedupe file

For fully deduped file, which means all its file exntents are
pointing to the same bytenr, btrfs can cause soft lockup when
calling fiemap ioctl on that file, like the following output:
------
CPU: 1 PID: 7500 Comm: xfs_io Not tainted 4.5.0-rc6+ #2
Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox
12/01/2006
task: ffff880027681b40 ti: ffff8800276e0000 task.ti: ffff8800276e0000
RIP: 0010:[<ffffffffa02583e4>]  [<ffffffffa02583e4>]
__merge_refs+0x34/0x120 [btrfs]
RSP: 0018:ffff8800276e3c08  EFLAGS: 00000202
RAX: ffff8800269cc330 RBX: ffff8800269cdb18 RCX: 0000000000000007
RDX: 00000000000061b0 RSI: ffff8800269cc4c8 RDI: ffff8800276e3c88
RBP: ffff8800276e3c20 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000000 R12: ffff880026ea3cb0
R13: ffff8800276e3c88 R14: ffff880027132a50 R15: ffff880027430000
FS:  00007f10201df700(0000) GS:ffff88003fa00000(0000)
knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f10201ec000 CR3: 0000000027603000 CR4: 00000000000406e0
Stack:
 0000000000000000 0000000000000000 0000000000000000 ffff8800276e3ce8
 ffffffffa0259f38 0000000000000005 ffff8800274c6870 ffff8800274c7d88
 0000000000c10000 0000000000000000 0000000000000001 0000000027431190
Call Trace:
 [<ffffffffa0259f38>] find_parent_nodes+0x448/0x740 [btrfs]
 [<ffffffffa025a4f2>] btrfs_check_shared+0x102/0x1b0 [btrfs]
 [<ffffffff811fdcad>] ? __might_fault+0x4d/0xa0
 [<ffffffffa021899c>] extent_fiemap+0x2ac/0x550 [btrfs]
 [<ffffffff811ce156>] ? __filemap_fdatawait_range+0x96/0x160
 [<ffffffffa01f8ee0>] ? btrfs_get_extent+0xb30/0xb30 [btrfs]
 [<ffffffffa01f5da5>] btrfs_fiemap+0x45/0x50 [btrfs]
 [<ffffffff81246bb8>] do_vfs_ioctl+0x498/0x670
 [<ffffffff81246e09>] SyS_ioctl+0x79/0x90
 [<ffffffff8184e997>] entry_SYSCALL_64_fastpath+0x12/0x6f
Code: 41 55 41 54 53 4c 8b 27 4c 39 e7 0f 84 e9 00 00 00 49 89 fd 49 8b
34 24 49 39 f5 48 8b 1e 75 17 e9 d5 00 00 00 49 39 dd 48 8b 03 <48> 89
de 0f 84 b9 00 00 00 48 89 c3 8b 46 2c 41 39 44 24 2c 75
------

Also btrfs will return wrong flag for all these extents, they should
have SHARED(0x2000) flags, while btrfs still consider them as
exclusive extents.

On the other hand, with unmerged xfs reflink patches, xfs can handle
it without problem, and for patched btrfs, it can also handle it.

This test case will create a large fully deduped file to check if
the fs can handle the fiemap ioctl and return correct SHARED flag
for any fs which support reflink.

Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
9 years agoxfs/133-4: filter redundant projid 0 quota report info out
Zorro Lang [Thu, 12 May 2016 02:55:19 +0000 (10:55 +0800)]
xfs/133-4: filter redundant projid 0 quota report info out

After GETNEXTQUOTA ioctl being supported, xfs_quota -c "report"
always outputs one more quota line about default quota (as project
ID 0). In order to fix this problem, xfsprogs has merged commit
3d607a1.

Now xfstests face this same problem from this issue. xfs/133 and
xfs/134 can't match their golden output, due to this one more line
quota report output. So this patch filters this redundant quota info
out.

There're 3 kinds of xfsprogs:
1. not support GETNEXTQUOTA
2. support GETNEXTQUOTA but not merged commit 3d607a1
3. the latest version supports all

The 1st one won't report Project ID 0, the 2nd will report projid 0
info as "(null) 0 0 0 ...", the 3rd will report projid 0 info as
"#0 0 0 0 ...". To deal with all of these situations, we will use

  _filter_quota | grep -v "^#0 \|^(null) "

But if someone specifies a name for projid 0, e.g.
  # cat $projid_file
  # root:0

I think that means someone wants to deal with it by himself, the
common filter won't filter it out.

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