ddiss/fstests.git
4 years agogeneric/225: Require fiemap support master
Jan Kara [Wed, 13 Aug 2014 01:20:59 +0000 (11:20 +1000)]
generic/225: Require fiemap support

Add _require_xfs_io_command "fiemap" to test 225 to properly handle the
situation when fiemap isn't supported by the filesystem.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agocommon: allow dmflakey tests to work without udev
Theodore Ts'o [Wed, 13 Aug 2014 01:20:57 +0000 (11:20 +1000)]
common: allow dmflakey tests to work without udev

If udev is not present, we need to run "dmsetup mknodes" to make sure
/dev/mapper/flakey-test is created or destroyed as appropriate.  On a
system with udev, running "dmsetup mknodes" will be a no-op.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agogeneric/077: fall back to /usr if /lib/modules doesn't exist
Theodore Ts'o [Wed, 13 Aug 2014 01:20:56 +0000 (11:20 +1000)]
generic/077: fall back to /usr if /lib/modules doesn't exist

We need a source of "filler" that can fill up a 50M file system.
Unfortunately, on some systems /lib/modules might not exist at all.
In that case, use /usr instead.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agobuild: Fix test for libgdbm_compat when building statically
Theodore Ts'o [Wed, 13 Aug 2014 01:20:54 +0000 (11:20 +1000)]
build: Fix test for libgdbm_compat when building statically

When building statically, -lgdbm_compat will not automatically pull in
-lgdbm.  So this needs to be specified explicitly in AC_CHECK_LIB and
in the list of libraries passed to the linker.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoconfig: allow chacl to be in any directory in $PATH
Theodore Ts'o [Wed, 13 Aug 2014 01:20:52 +0000 (11:20 +1000)]
config: allow chacl to be in any directory in $PATH

Previously, xfstests checked for chacl in only a few hard-coded
directory: /bin, /sbin, and /usr/bin.  Use set_prog_path to allow
chacl to be in any directory in $PATH, which is how we find the
executable path for most other executables.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agobtrfs: add regression test for btrfs send with orphans
Filipe Manana [Wed, 13 Aug 2014 01:20:37 +0000 (11:20 +1000)]
btrfs: add regression test for btrfs send with orphans

Regression test for a btrfs issue where we create a RO snapshot
to use for a send operation, which fails with a -ESTALE error,
due to the presence of orphan inodes accessible through the
snapshot's commit root but no longer present through the main
root.

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

  Btrfs: update commit root on snapshot creation after orphan cleanup

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoext4: add new compacting defragmentation test
Dmitry Monakhov [Wed, 13 Aug 2014 01:20:35 +0000 (11:20 +1000)]
ext4: add new compacting defragmentation test

EXT4_MOVE_EXTENT is ready to support case where orig_offset != donor_offset.
This case is usable for compacting small files together.
Test generate file hierarchy via fsstress and then compact all files
to one adjacent block.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agogeneric: add new defragment test
Dmitry Monakhov [Wed, 13 Aug 2014 01:19:33 +0000 (11:19 +1000)]
generic: add new defragment test

Check defrag utility on file with large number of fragments, from 20 to 2000.
2000 fragments means that b+tree will have at least two index blocks.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agodefrag: add options to _defrag helper
Dmitry Monakhov [Wed, 13 Aug 2014 01:16:49 +0000 (11:16 +1000)]
defrag: add options to _defrag helper

Sometimes it is not easy to know number of expected extents in advance.
In that case it is reasonable to provide sane MIN and MAX values.
Also helper will check that number of extents before defragmentaion
is not greather than after.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agobtrfs: check for matching kernel send stream
Anand Jain [Wed, 13 Aug 2014 01:16:42 +0000 (11:16 +1000)]
btrfs: check for matching kernel send stream

The test case btrfs/049 is relevant to send stream version 2, and
needs kernel patches as well. So call _notrun if there isn't
matching kernel support as shown below

btrfs/047  [not run] Missing btrfs kernel patch for send stream version 2, skipped this test
Not run: btrfs/047

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfs: test strided xfs_repair on large filesystems
Eryu Guan [Wed, 13 Aug 2014 01:16:39 +0000 (11:16 +1000)]
xfs: test strided xfs_repair on large filesystems

Test segfault issue when repairing large xfs.

Regression test for xfsprogs commit
7f2d6b8 xfs_repair: avoid segfault if reporting progress early in repair

The original test is from the commit log, written by Eric Sandeen.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfs/007: add project quota Q_XQUOTARM test
Jie Liu [Wed, 13 Aug 2014 01:15:46 +0000 (11:15 +1000)]
xfs/007: add project quota Q_XQUOTARM test

Add test for project quota Q_XQUOTARM operations, update the
golden output file to match the new test output.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agocommon: _devmgt_add() to check if the device is back online
Anand Jain [Wed, 13 Aug 2014 01:15:43 +0000 (11:15 +1000)]
common: _devmgt_add() to check if the device is back online

btrfs/003 uses a method to remove the device as part of the test
case, and after the test completes the removed device is added
back to the system. However on certain system, albeit the slow
running system the device comes back a bit later, and so the
latter occurring sub-test with in the btrfs/003 fails.

This patch adds script to wait and test if the device is back online,
and thus report the same to to the full log.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoshared/006: use _get_free_inode helper
Eryu Guan [Wed, 13 Aug 2014 01:15:41 +0000 (11:15 +1000)]
shared/006: use _get_free_inode helper

Use _get_free_inode helper to get free inode count.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfs: test inode allocations in post-growfs disk space
Eryu Guan [Wed, 13 Aug 2014 01:15:23 +0000 (11:15 +1000)]
xfs: test inode allocations in post-growfs disk space

Make sure inodes can be allocated in new space added by xfs_growfs.

Regression test for
xfs: allow inode allocations in post-growfs disk space

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoext4: regression test for wrong assert in ext4_mb_normalize_request()
Xiaoguang Wang [Wed, 13 Aug 2014 01:15:15 +0000 (11:15 +1000)]
ext4: regression test for wrong assert in ext4_mb_normalize_request()

Regression test for:
    b5b6077 ext4: fix wrong assert in ext4_mb_normalize_request()

Meanwhile make minor changes to _scratch_mkfs_ext4() in common/rc,
_scratch_mkfs_ext4() might fail due to conflicts between being passed options
and MKFS_OPTIONS. We fix this by ignoring MKFS_OPTIONS if it fails the first
time(see _scratch_mkfs_xfs()), as suggested by Lukas Czerner.

[dchinner: converted to use xfs_io]

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agocommon: Check fs consistency on TEST_DEV only when needed
Lukas Czerner [Wed, 13 Aug 2014 01:08:41 +0000 (11:08 +1000)]
common: Check fs consistency on TEST_DEV only when needed

Currently we're checking file system consistency on TEST_DEV after every
successful test run even though the TEST_DEV might not even be used in
that test.

Fix it by introducing _require_test to for the test ti indicate that
it's about to use TEST_DEV.

Also add _require_test to the new script so that this requirement is a
default.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agocommon: Check the file system consistency on SCRATCH_DEV
Lukas Czerner [Wed, 13 Aug 2014 01:01:04 +0000 (11:01 +1000)]
common: Check the file system consistency on SCRATCH_DEV

There are about 198 tests which requires scratch_dev, but does not check
the file system consistency afterwards. Xfstests infrastructure does not
do it automatically, so fix it by running _check_scratch_fs() after
each test that _require_scratch.

Also remove all the _check_scratch_fs() calls that are not actually needed
and will be covered by the check script.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfs/291: use xfs_repair -f when repairing a fs image
Eric Sandeen [Wed, 13 Aug 2014 01:00:46 +0000 (11:00 +1000)]
xfs/291: use xfs_repair -f when repairing a fs image

test xfs/291 creates an xfs_metadump image and runs repair on it.
Technically, this is supposed to require "-f" to specify that
the target of the repair is a file; this allows buffered IO fallback
in the case where the image sector size is smaller than the device
sector size.  And in fact if we create the image on a hard 4k device,
the test will fail when repair is unable to operate on the image.

So add that -f!

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfs/300: redirect mkfs output to results/xfs directory
Xing Gu [Wed, 13 Aug 2014 01:00:43 +0000 (11:00 +1000)]
xfs/300: redirect mkfs output to results/xfs directory

Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfs/292: fix format of expected message
Xing Gu [Wed, 13 Aug 2014 01:00:38 +0000 (11:00 +1000)]
xfs/292: fix format of expected message

In mkfs.xfs, it uses left-align and fixed width format when outputting
device name, so variable length of devicename makes different space's
number between "meta-data=devicename" and "isize". But in the expected
output, the space' number between them is fixed. This behavior often
results in the case failure. So fix the format of expected message.

Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoaio: test closing the fd before destroying the ioctx
Jeff Moyer [Wed, 13 Aug 2014 01:00:38 +0000 (11:00 +1000)]
aio: test closing the fd before destroying the ioctx

By closing the file descriptor before calling io_destroy, you pretty
much guarantee that the last put on the ioctx will be done in interrupt
context (during I/O completion).  This behavior has unearthed bugs in
the kernel in several different kernel versions, so let's add a test to
poke at it.

The original test case was provided by Matt Cross.  He has graciously
relicensed it under the GPL v2 or later so that it can be included in
xfstests.  I've modified the test a bit so that it would generate a
stable output format and to run for a fixed amount of time.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agobtrfs: add qgroup rescan stress test
Wang Shilong [Wed, 13 Aug 2014 00:59:59 +0000 (10:59 +1000)]
btrfs: add qgroup rescan stress test

Test flow is to run fsstress after triggering quota rescan.
the ruler is simple, we just remove all files and directories,
sync filesystem and see if qgroup's ref and excl are nodesize.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agogeneric/317,318: fail gracefully if userns not supported
Eric Sandeen [Tue, 17 Jun 2014 23:34:39 +0000 (09:34 +1000)]
generic/317,318: fail gracefully if userns not supported

generic/317 and generic/318 fail un-gracefully on older kernels
which don't support userns; fix that by running a simple test
as a prerequisite and fail gracefully if needed.

Roll that in with the test for executable presence, and make
a new _require_userns()

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfs/279: use MKFS_XFS_PROG, not hardcoded path
Eric Sandeen [Tue, 17 Jun 2014 23:34:03 +0000 (09:34 +1000)]
xfs/279: use MKFS_XFS_PROG, not hardcoded path

I'm really not sure why this wasn't this way from the start.
On some systems it's in /usr/sbin, and the test fails.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfstests: create a test for xfs log grant head leak detection
Brian Foster [Tue, 17 Jun 2014 23:33:46 +0000 (09:33 +1000)]
xfstests: create a test for xfs log grant head leak detection

Changes in the XFS logging code have lead to small leaks in the log
grant heads that consume log space slowly over time. Such problems have
gone undetected for an unnecessarily long time due to code complexity
and potential for very subtle problems. Losing only a few bytes per
logged item on a reasonably large enough fs (10s of GB) means only the
most continuously stressful workloads will cause a severe enough failure
(deadlock due to log reservation exhaustion) quickly enough to indicate
something is seriously wrong.

Recent changes in XFS export the state of the various log heads through
sysfs to aid in userspace/runtime analysis of the log. This test runs a
workload against an XFS filesystem, quiesces the fs and verifies that
the log reserve and write grant heads have not leaked any space with
respect to the current head of the physical log.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfstests: test speculative preallocation reclaim on ENOSPC/EDQUOT
Brian Foster [Tue, 17 Jun 2014 23:33:26 +0000 (09:33 +1000)]
xfstests: test speculative preallocation reclaim on ENOSPC/EDQUOT

XFS can allocate significant amounts of space to files via speculative
preallocation. Such preallocation may not be reclaimed automatically on
file close() if a file is repeatedly opened and extended. For smaller
filesystems with relatively large and slow growing files, this
preallocation can linger for some time, including contributing to out of
space conditions.

Create a situation where an fs is near out of space while several files
still have lingering, significant preallocations. Verify that new
writers reclaim the preallocated space rather than return ENOSPC. Repeat
a similar test for quota limits and EDQUOT.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agosrc/cloner: add CIFS_IOC_COPYCHUNK_FILE support
David Disseldorp [Tue, 17 Jun 2014 23:32:59 +0000 (09:32 +1000)]
src/cloner: add CIFS_IOC_COPYCHUNK_FILE support

cifs.ko supports server-side copy offloads via CIFS_IOC_COPYCHUNK_FILE.
In handling the ioctl, the request is split into a series of
SMB2 FSCTL_SRV_COPYCHUNK wire requests, which may be handled by the SMB
server as a local read/write, or COW clone as is the case for Samba with
vfs_btrfs.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agosrc/cloner: check filesystem type
David Disseldorp [Tue, 17 Jun 2014 23:32:25 +0000 (09:32 +1000)]
src/cloner: check filesystem type

Limit clone requests to Btrfs only for the moment.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agogeneric: new case to test getcwd(2)
Eryu Guan [Tue, 17 Jun 2014 23:31:38 +0000 (09:31 +1000)]
generic: new case to test getcwd(2)

The following kernel commit introduced a race condition that causes
getcwd(2) to return "/" instead of correct path

232d2d6 dcache: Translating dentry into pathname without taking rename_lock

Jan Stancek hit it once when building ltp and Mikulas Patocka could
hit it by running lvm2 test suite. Please refer to this thread

https://www.mail-archive.com/ltp-list@lists.sourceforge.net/msg17896.html

These commits fixed the bug
ede4ceb prepend_path() needs to reinitialize dentry/vfsmount/mnt on restarts
f650080 __dentry_path() fixes

Cc: Artem Savkov <asavkov@redhat.com>
Cc: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoJFS: Add maximum ACL count into common/attr
Michael L. Semon [Tue, 17 Jun 2014 23:31:01 +0000 (09:31 +1000)]
JFS: Add maximum ACL count into common/attr

Enter max ACL count into common/attr for JFS, with the purpose of
getting JFS to pass xfstests generic/026.

Signed-off-by: Michael L. Semon <mlsemon35@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agobtrfs: add test for btrfs clone + fsync durability
Filipe David Borba Manana [Tue, 17 Jun 2014 23:30:29 +0000 (09:30 +1000)]
btrfs: add test for btrfs clone + fsync durability

Regression test for btrfs ioctl clone operation + fsync + log
recovery. The issue was that doing an fsync after cloning into
a file didn't gave any persistence guarantees as it should.
What happened was that the in memory metadata (extent maps)
weren't updated, which made the fsync code not able to detect
that file data has been changed and must be persisted to the
log.

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

    Btrfs: make fsync work after cloning into a file

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoresvtest.c: fix invalid use of sizeof()
Jeff Moyer [Tue, 17 Jun 2014 23:29:57 +0000 (09:29 +1000)]
resvtest.c: fix invalid use of sizeof()

sizeof(pointer) will give you the size of a pointer, not the space
allocated to it.  I noticed this when gcc complained:

resvtest.c:76:33: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
  memset(writebuffer, 'A', sizeof(writebuffer));

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfs/013: allow non-write fsstress operations in background workload
Brian Foster [Tue, 17 Jun 2014 23:29:22 +0000 (09:29 +1000)]
xfs/013: allow non-write fsstress operations in background workload

It has been reported that test xfs/013 probably uses more space than
necessary, exhausting space if run against a several GB sized ramdisk.
xfs/013 primarily creates, links and removes inodes. Most of the space
consumption occurs via the background fsstress workload.

Remove the fsstress -w option that suppresses non-write operations. This
slightly reduces the storage footprint while still providing a
background workload for the test.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agobtrfs: add test for btrfs cloning with file holes
Filipe David Borba Manana [Tue, 17 Jun 2014 23:29:00 +0000 (09:29 +1000)]
btrfs: add test for btrfs cloning with file holes

Regression test for the btrfs ioctl clone operation when the source range
contains hole(s) and the FS has the NO_HOLES feature enabled (file holes
don't need file extent items in the btree to represent them).

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

    Btrfs: fix clone to deal with holes when NO_HOLES feature is enabled

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agobtrfs: test for btrfs send when nested subvols/snapshots exist
Filipe David Borba Manana [Tue, 27 May 2014 02:07:42 +0000 (12:07 +1000)]
btrfs: test for btrfs send when nested subvols/snapshots exist

Regression test for a btrfs incremental send issue where the difference
between the snapshots used by the incremental send consists of one of
these cases:

1) First snapshot has a directory with name X and in the second snapshot
   that directory doesn't exist anymore but a subvolume/snapshot with
   the same name (X) exists;

2) First snapshot has a subvolume/snapshot with name X and in the second
   snapshot that subvolume/snapshot doesn't exist anymore (might have been
   replaced by a directory with the same name or not).

This issue is fixed by the following linux kernel btrfs patches:

    Btrfs: send, don't error in the presence of subvols/snapshots
    Btrfs: set dead flag on the right root when destroying snapshot

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agobtrfs: add test for btrfs send with large xattrs
Filipe David Borba Manana [Tue, 27 May 2014 02:07:39 +0000 (12:07 +1000)]
btrfs: add test for btrfs send with large xattrs

Verify that btrfs send is able to replicate xattrs larger than
PATH_MAX. This is possible if the b+tree leaf size is larger
than 4Kb (mkfs.btrfs's default is max(16Kb, PAGE_SIZE) as of
btrfs-progs v3.12, and max(4Kb, PAGE_SIZE in older versions).

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

   Btrfs: send, use the right limits for xattr names and values

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agobtrfs: add test for clone operation
Filipe David Borba Manana [Tue, 27 May 2014 02:07:36 +0000 (12:07 +1000)]
btrfs: add test for clone operation

This is a test to verify that the btrfs ioctl clone operation is
able to clone extents of a file to different positions of the file,
that is, the source and target files are the same. Existing tests
only cover the case where the source and target files are different.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agocommon: add helper require function _require_btrfs_cloner
Filipe David Borba Manana [Tue, 27 May 2014 02:07:36 +0000 (12:07 +1000)]
common: add helper require function _require_btrfs_cloner

So that the same check (btrfs cloner program presence) can be reused
by other tests.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfs/005: filter _scratch_mount output to match golden image
Eryu Guan [Tue, 27 May 2014 02:07:17 +0000 (12:07 +1000)]
xfs/005: filter _scratch_mount output to match golden image

Failure message of mount has been changed since util-linux v2.21, to
something like:

mount: mount /dev/sda5 on /mnt/scratch failed: Structure needs cleaning

Filter the output to match the golden image for newer mount binary so
that both old and new version of mount work correctly.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agogeneric: new ENOSPC regression test
Eryu Guan [Tue, 27 May 2014 02:07:17 +0000 (12:07 +1000)]
generic: new ENOSPC regression test

Run 8 processes writing 1k files to seperate files in seperate dirs to
hit ENOSPC on small fs with little free space. Loop for 100 iterations.

Regression test for
34cf865 ext4: fix deadlock when writing in ENOSPC conditions

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agobtrfs: add test for btrfs send with long paths
Filipe David Borba Manana [Tue, 27 May 2014 02:07:03 +0000 (12:07 +1000)]
btrfs: add test for btrfs send with long paths

Regression test for btrfs send where long paths (exceeding 230 characters)
made send produce paths with random characters from a memory buffer returned
by kmalloc, as send forgot to populate the new buffer with the path string.

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

   Btrfs: send, fix corrupted path strings for long paths

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoconfig: make sure tests check for loop device support
Brian Foster [Thu, 15 May 2014 01:37:55 +0000 (11:37 +1000)]
config: make sure tests check for loop device support

Several tests happen to make use of loop device support without the
requisite pre-test checks. This results in spurious failures for systems
that might not have loop device support. Add _require_loop checks to
shared/298, xfs/206 and xfs/259.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agobtrfs: add regression test for send with extrefs
Filipe David Borba Manana [Thu, 15 May 2014 01:37:54 +0000 (11:37 +1000)]
btrfs: add regression test for send with extrefs

Regression for btrfs send when an inode only has extended references
associated to it (no regular references present). This used to cause
incorrect access to a b+tree leaf, where an extended reference item
was accessed as if it were a regular reference item, causing unexpected
and unpredictable behaviour such as producing a random/weird path string
or a crash.

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

   Btrfs: send, fix incorrect ref access when using extrefs

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfs/013: use killall -9 and wait in _cleanup()
Brian Foster [Thu, 15 May 2014 01:37:49 +0000 (11:37 +1000)]
xfs/013: use killall -9 and wait in _cleanup()

Kill any lingering fsstress processes and wait properly should we abort
the test. This prevents the workload from inadvertently affecting
subsequent tests.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agologgen: fix build vs. newer xfsprogs headers
Jeff Layton [Thu, 15 May 2014 01:34:56 +0000 (11:34 +1000)]
loggen: fix build vs. newer xfsprogs headers

v2: just include xfs/libxfs.h for the conftest prerequisites

commit cc085d770adb in xfsprogs removed some header files that are
included by loggen.c. Add an autoconf test that checks to see whether
xfs_log_format.h is present. If it is, include that instead of the
deprecated headers and add an alias for XFS_TRANS_MAGIC since that
value no longer exists.

With this patch, xfstests builds on both f20 and rawhide (f21) boxes.

Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agolocktest: add a F_GETLK vs. openmode test
Jeff Layton [Tue, 13 May 2014 05:30:24 +0000 (15:30 +1000)]
locktest: add a F_GETLK vs. openmode test

POSIX says that you're allowed to do F_GETLK for a F_WRLCK on an
O_RDONLY file description.

Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agolocktest: consolidate do_lock and do_unlock, and add ability to F_GETLK
Jeff Layton [Tue, 13 May 2014 05:30:23 +0000 (15:30 +1000)]
locktest: consolidate do_lock and do_unlock, and add ability to F_GETLK

Eliminate do_unlock as it's just cut-and-paste of do_lock (down to the
bad stderr fprintf). Fix the debug messages to print the cmd and type,
and add the ability to do a WRTEST and RDTEST.

Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agolocktest: set f_fd to INVALID_HANDLE on close
Jeff Layton [Tue, 13 May 2014 05:30:23 +0000 (15:30 +1000)]
locktest: set f_fd to INVALID_HANDLE on close

Ensure that the fd is marked invalid after close. Also, the "closed"
and "reopen" variables are always set to 0. Remove them.

Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agolocktest: don't assume that F_OPEN should use O_RDWR
Jeff Layton [Tue, 13 May 2014 05:30:18 +0000 (15:30 +1000)]
locktest: don't assume that F_OPEN should use O_RDWR

In a later patch, I'll be adding a test for F_GETLK that will require
that we open the file with a different f_mode. Change do_open not to
assume that the it needs to open the file O_RDWR.

While we're at it, fix a bug in do_open. Just because we pass in '0' for
the flags, doesn't mean that this is the initial open.  Move the exit(1)
for that case to the caller.

Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoconfig: fix selinux context handling
Josef Bacik [Tue, 13 May 2014 05:30:15 +0000 (15:30 +1000)]
config: fix selinux context handling

With the new config stuff we lost the selinux options being set for systems with
selinux turned on.  We want the selinux context set all the time, wether we
provide a MOUNT_OPTIONS value or not, so take this logic out of _mount_opts()
and just put it in the body of common/config

Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agocommon: fix flink check
Josef Bacik [Tue, 13 May 2014 05:30:03 +0000 (15:30 +1000)]
common: fix flink check

I don't have flink support in my xfsprogs, but it doesn't fail with "command not
found" or whatever, it fails because I don't have the -T option, whereas Eric
gets an error about $TEST_DIR being a directory because his xfs_io tries to open
the directory first before it parses the options.  So fix this by checking flink
with these two cases and don't run if we hit either of them.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agobtrfs: add regression test for inode cache vs tree log
Wang Shilong [Tue, 13 May 2014 05:29:37 +0000 (15:29 +1000)]
btrfs: add regression test for inode cache vs tree log

This patch adds a regression test to verify btrfs can not
reuse inode id until we have committed transaction. Which was
addressed by the following kernel patch:

 Btrfs: fix inode cache vs tree log

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agocommon: use a relative path to fsstress
hch@infradead.org [Tue, 13 May 2014 05:28:37 +0000 (15:28 +1000)]
common: use a relative path to fsstress

All commands run as $qa_user should use a relative path so that
missing access permissions on $HOME for root don't prevent running
it.  This fixes common/233 for me.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfs/013: stress the free inode btree
Brian Foster [Tue, 13 May 2014 05:28:35 +0000 (15:28 +1000)]
xfs/013: stress the free inode btree

Create a stress test for the free inode btree. Allocate a set of inodes
sequentually and run a hard link clone and random replacement algorithm
across the set. Background removal of the oldest directories creates a
sparse set of free inodes over time. Run an fsstress workload
concurrently to exercise the fs.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfs/010: test repair for finobt corruption
Brian Foster [Tue, 13 May 2014 05:27:47 +0000 (15:27 +1000)]
xfs/010: test repair for finobt corruption

The finobt creates a duplicate subset of inode allocation metadata from
the inobt. xfs_repair should detect and repair inconsistencies in the
finobt that could be caused by bugs or corruption. This test uses xfs_db
to cause targeted corruptions in the finobt and verify repair detects
and corrects the filesystem.

In particular, the test corrupts individual finobt records to cause
inconsistency between the inode allocation count fields as well as
causing the finobt to contain a record with no free inodes.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agorepair: filter agno/ino repair output for finobt
Brian Foster [Tue, 13 May 2014 05:27:47 +0000 (15:27 +1000)]
repair: filter agno/ino repair output for finobt

finobt enabled filesystems can generate new repair output. Update
_filter_repair() to ensure specific AG and inode numbers are filtered
from test output.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agocommon: add _require_xfs_[mkfs_]finobt() checks for finobt tests
Brian Foster [Tue, 13 May 2014 05:27:30 +0000 (15:27 +1000)]
common: add _require_xfs_[mkfs_]finobt() checks for finobt tests

Free inode btree tests must ensure that the userspace and kernel bits
are compatible. Add a couple checks for the associated support.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfs/030: filter out extra repair noise for finobt enabled fs'
Brian Foster [Tue, 13 May 2014 05:26:59 +0000 (15:26 +1000)]
xfs/030: filter out extra repair noise for finobt enabled fs'

xfs/030 nukes various on-disk data structures to test for repair. This
can result in extra output when testing finobt enabled filesystems. For
example, xfs_repair detects an invalid free inode btree root block when
the agi is zeroed.

Filter this output directly in xfs/030 such that the test passes for
finobt and non-finobt filesystems.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agofsstress: fix incorrect if condition check for collapse range mode
Namjae Jeon [Tue, 13 May 2014 05:26:59 +0000 (15:26 +1000)]
fsstress: fix incorrect if condition check for collapse range mode

There is if condition to be block aligned for off and len of Collapse range.
But off and len for all fallocate opearion can be aligned by incorrect
if condition check.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agocommon: new function to get real device path name and basename
Eryu Guan [Mon, 12 May 2014 23:05:43 +0000 (09:05 +1000)]
common: new function to get real device path name and basename

If TEST_DEV or SCRATCH_DEV is symlink(mostly a lvm lv), a simple
basename is not enough, symlink should be followed.

This task is common enough, so introduce new helper functions and
replace all readlink calls in

ext4/305
generic/009
generic/019
generic/285
generic/312

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agocheck: add support for an external file containing tests to exclude
Theodore Ts'o [Mon, 12 May 2014 23:04:13 +0000 (09:04 +1000)]
check: add support for an external file containing tests to exclude

Currently the -X option is intended to specify a set of expunging
files which are stored in each test/* subdirectory.  As described in
the commit description for 0b1e8abd4, in order to exclude the test
generic/280, the -X option is used as follows:

    $ cat tests/generic/3.0-stable-avoid
    280
    $ sudo ./check -X 3.0-stable-avoid generic/280

However, it is sometimes useful to store the set of expunged tests in
a single file, outside of tests/* subdirectories.  This commit enables
the following:

    $ cat /root/conf/data_journal.exclude
    generic/068
    ext4/301
    $ sudo ./check -E /root/conf/data_journal.exclude -g auto

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agocommon: Use _require_xfs_io_command() instead of helpers
Lukas Czerner [Mon, 28 Apr 2014 00:55:12 +0000 (10:55 +1000)]
common: Use _require_xfs_io_command() instead of helpers

Number of helpers for checking xfs_io functionality is slowly
growing.  But it's as easy to simply use _require_xfs_io_command()
directly and just specify the command we want to check. It will also
avoid the need to create helper every time we need to check a new
command in xfs_io.

Remove all the helpers and use _require_xfs_io_command() in the
tests.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agogeneric: introduce new large ACL test
Dave Chinner [Mon, 28 Apr 2014 00:55:12 +0000 (10:55 +1000)]
generic: introduce new large ACL test

Having just removed the largeacl test from the shared ACL test,
reintroduce the same test as an generic test so that we can
handle the different limits in supported ACL count appropriately
across different filesystems and different configurations within
filesystem types.

Filesystems have to add support to _acl_get_max to run
this test - the default behaviour right now is to throw a
notrun error like this:

generic/026 14s ... [not run] ext4 does not define maximum ACL count

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoshared/051: remove ACL count subtest
Dave Chinner [Mon, 28 Apr 2014 00:55:04 +0000 (10:55 +1000)]
shared/051: remove ACL count subtest

Different versions of XFS support different numbers of ACLs on disk.
Remove that subtest from this shared test to prevent it form causing
spurious failures on filesystems that support more than 25 ACLs.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agofilter: xfs_repair emits new corruption messagse
Dave Chinner [Mon, 28 Apr 2014 00:54:53 +0000 (10:54 +1000)]
filter: xfs_repair emits new corruption messagse

xfs_repair now dumps metadata and CRC corruption information to the
output from the verifier infrastrcuture. Filter this out so that it
doesn't cause spurious test failures such as in xfs/030 and xfs/033.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agoxfs: remove dmapi tests from the auto group
Dave Chinner [Mon, 28 Apr 2014 00:54:45 +0000 (10:54 +1000)]
xfs: remove dmapi tests from the auto group

There is no mainline kernel support for DMAPI in XFS, and so every
time the xfstests auto group is run it throws a large number of
"[not run] Assuming DMAPI modules are not loaded". I've noted that
people are excluding the dmapi group to avoid this, so rather than
inflict pain on everyone, make hose few that need to do dmapi
testing include it specifically.

IOWs, remove the DMAPI tests from the auto group.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agogeneric: cleanup space after test in TESTDIR
Dave Chinner [Mon, 28 Apr 2014 00:54:38 +0000 (10:54 +1000)]
generic: cleanup space after test in TESTDIR

A couple of tests leave behind large files or directory structures
when they complete, which leads to small TEST_DEVs running out of
space during other tests. Make those space hogs clean up after
themselves so that random tests don't fail with ENOSPC errors.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
4 years agogeneric/204: tweak reserve pool size
Dave Chinner [Mon, 28 Apr 2014 00:54:27 +0000 (10:54 +1000)]
generic/204: tweak reserve pool size

On small block size filesystems, the reserve pool size is kept
constant at 4MB. filesystems with smaller blocks use comparitively
more blocks for indexing metadata (e.g. in the inode and extent
btrees) and so having a higher indirect block usage. Hence we need
to leave the reserve pool at 1024 block and not scale it for a
constant size.

This makes the test pass on a filesystem made with MKFS_OPTIONS="-b
size=1024 -m crc=1".

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agoxfs/167: need at least 10GB of scratch space to run
Dave Chinner [Tue, 22 Apr 2014 01:00:55 +0000 (11:00 +1000)]
xfs/167: need at least 10GB of scratch space to run

When running on a ramdisk, the fsstress background workload consumes
a GB of disk space every 5 seconds. This leads to the test failing
with ENOSPC because the test file cannot be created due otthe
background load cosuming it all. Hence don't run this test unless
the scratch device is large enough not to hit ENOSPC conditions.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agogeneric/009: fix check for zero range support
Eric Whitney [Tue, 22 Apr 2014 00:47:53 +0000 (10:47 +1000)]
generic/009: fix check for zero range support

Generic/009 fails when run on a file system that does not support byte range
zeroing.  For example, an EOPNOTSUPP failure occurs when the test is run
on a pre-3.15 extent-mapped file system.  The code in the test intended
to prevent this contains an apparent typo that results in a check for
fallocate() rather than zero range support.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agoext4/001: fix check for zero range support
Eric Whitney [Tue, 22 Apr 2014 00:47:33 +0000 (10:47 +1000)]
ext4/001: fix check for zero range support

Ext4/001 fails when run on a file system that does not support byte range
zeroing.  For example, an EOPNOTSUPP failure occurs when the test is run
on a pre-3.15 extent-mapped file system.  The code in the test intended
to prevent this contains an apparent typo that results in a check for
fallocate() rather than zero range support.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agocommon: add helper for zero range support check
Eric Whitney [Tue, 22 Apr 2014 00:47:28 +0000 (10:47 +1000)]
common: add helper for zero range support check

Add a helper function to verify fallocate zero range support in a style
similar to _require_xfs_io_falloc_collapse(), etc.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agoxfs: test X_QUOTARM functionality
Eric Sandeen [Tue, 22 Apr 2014 00:47:28 +0000 (10:47 +1000)]
xfs: test X_QUOTARM functionality

The Q_XQUOTARM quotactl was not working properly, because
we weren't passing in proper flags.  The xfs_fs_set_xstate()
ioctl handler used the same flags for Q_XQUOTAON/OFF as
well as Q_XQUOTARM, but Q_XQUOTAON/OFF look for
XFS_UQUOTA_ACCT, XFS_UQUOTA_ENFD, XFS_GQUOTA_ACCT etc,
i.e. quota type + state, while Q_XQUOTARM looks only for
the type of quota, i.e. XFS_DQ_USER, XFS_DQ_GROUP etc.

Unfortunately these flag spaces overlap a bit, so we
got semi-random results for Q_XQUOTARM; i.e. the value
for XFS_DQ_USER == XFS_UQUOTA_ACCT, etc.  yeargh.

Anyway, here's a simple test that demonstrates it,
kernel patch to fix it will follow.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agogeneric/285: fix test for generic SEEK_HOLE/DATA implementations
Konstantin Khlebnikov [Tue, 22 Apr 2014 00:47:23 +0000 (10:47 +1000)]
generic/285: fix test for generic SEEK_HOLE/DATA implementations

Generic implementation of SEEK_HOLE/DATA reports whole file as data chunk with
virtual hole at the end (generic_file_llseek, used by ext2/ext3/reiserfs/nfs).

Currently test prepares file smaller than expected for "huge file" testcases
(testcases 10-12). This patch fixes test file layout, now second data chunk
ends right at the expected end of file.

Plus it fixes type of 'filesz' argument, it should be off_t.

Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agofsx: introduce FSX_AVOID env var
Eric Sandeen [Tue, 22 Apr 2014 00:46:49 +0000 (10:46 +1000)]
fsx: introduce FSX_AVOID env var

Just like FSSTRESS_AVOID, FSX_AVOID can be used to add
options at the end of the default fsx runs in each test.
i.e. FSX_AVOID="-H -z -C" will disable punch hole, zero range,
and collapse range calls in all tests which run fsx.

This should handle Ted's concerns about buggy ext4 fallocate
code without needing to add tunables to the kernel to reject
these operations during xfstests runs.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agobtrfs/004: fix failure with inlined file extents
Filipe David Borba Manana [Tue, 22 Apr 2014 00:46:41 +0000 (10:46 +1000)]
btrfs/004: fix failure with inlined file extents

Files that consist of an inline extent, have the corresponding
data in the filesystem btree and not on a dedicated extent. For
such extents filefrag (fiemap) will report a physical location
of 0 for that extent and set the 'inline' flag.

The btrfs inspect-internal logical-resolve command will cause a
lookup in the extent tree for the extent address we give it as
an argument, which fails with errno ENOENT if it is 0.

This error didn't happen always, as the test uses fsstress to
generate a random filesystem, which needed to generate at least
one file that could be inlined (content less than 4018 bytes).

Example, taken from results/btrfs/004.full:

   # filefrag -v /home/fdmanana/btrfs-tests/scratch_1/snap1/p0/de/d1b/dcb/fb1
   Filesystem type is: 9123683e
   File size of /home/fdmanana/btrfs-tests/scratch_1/snap1/p0/de/d1b/dcb/fb1 is 3860 (1 block of 4096 bytes)
    ext:     logical_offset:        physical_offset: length:   expected: flags:
      0:        0..    4095:          0..      4095:   4096:             not_aligned,inline,eof
      1:      280..     344:      35190..     35254:     65:          1: eof
   /home/fdmanana/btrfs-tests/scratch_1/snap1/p0/de/d1b/dcb/fb1: 2 extents found
   after filter: 0#0#0 0#0#0
   # stat -c %i /home/fdmanana/btrfs-tests/scratch_1/snap1/p0/de/d1b/dcb/fb1
   403
   # /home/fdmanana/git/hub/btrfs-progs/btrfs inspect-internal logical-resolve -P 0 /home/fdmanana/btrfs-tests/scratch_1
   ioctl ret=-1, error: No such file or directory

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agobtrfs/004: fix filefrag filter for files with 1 block only
Filipe David Borba Manana [Tue, 22 Apr 2014 00:46:34 +0000 (10:46 +1000)]
btrfs/004: fix filefrag filter for files with 1 block only

If the file consists of a single block, then filefrag mentions
'1 block of ...', and the filter expected 'blocks of ...'.

Example:

$ echo qwerty > foobar
$ filefrag -v foobar
Filesystem type is: ef53
File size of foobar is 7 (1 block of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..       0:          0..         0:      1:             unknown,delalloc,eof
foobar: 1 extent found

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agocommon: Remove unused functions
Lukas Czerner [Tue, 22 Apr 2014 00:46:25 +0000 (10:46 +1000)]
common: Remove unused functions

Functions like _mount_opts(), _mkfs_opts() and _fsck_opts() are
defined both in common/rc and common/config while used only in
common/config.

Remove those functions from common/rc and update _mount_opts() to match
the superior version of the function.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agocommon: set _fs_has_crcs=0 as default in _filter_mkfs()
Eryu Guan [Tue, 22 Apr 2014 00:46:17 +0000 (10:46 +1000)]
common: set _fs_has_crcs=0 as default in _filter_mkfs()

xfsprogs without crc support won't print crc=0/crc=1, so
_filter_mkfs() leaves _fs_has_crcs variable unset, and xfs/033 fails
because of that.

xfs/033 4s ... - output mismatch (see /root/xfstests/results//xfs/033.out.bad)
    --- tests/xfs/033.out       2014-04-16 22:31:49.818350450 -0400
    +++ /root/xfstests/results//xfs/033.out.bad 2014-04-16 22:35:08.264401190 -0400
    @@ -5,6 +5,7 @@
     naming   =VERN bsize=XXX
     log      =LDEV bsize=XXX blocks=XXX
     realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
    +./tests/xfs/033: line 87: [: -eq: unary operator expected
     Corrupting root inode - setting bits to 0
     Wrote X.XXKb (value 0x0)
     Phase 1 - find and verify superblock...

Print _fs_has_crcs=0 to stderr by default, so old xfsprogs could have
this variable set too, and a latter _fs_has_crcs=1 could overwrite it
if the fs does have crc support.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agofsstress: remove duplicate COLLAPSE_RANGE flags
Namjae Jeon [Tue, 22 Apr 2014 00:46:12 +0000 (10:46 +1000)]
fsstress: remove duplicate COLLAPSE_RANGE flags

Remove duplicate COLLAPSE_RANGE flags

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agobtrfs: add test for btrfs properties
Filipe David Borba Manana [Tue, 22 Apr 2014 00:46:04 +0000 (10:46 +1000)]
btrfs: add test for btrfs properties

This test case verifies the btrfs properties feature, a new feature
introduced in the linux kernel version 3.14.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agobtrfs: punch holes and prealloc extents with send
Filipe David Borba Manana [Tue, 22 Apr 2014 00:45:53 +0000 (10:45 +1000)]
btrfs: punch holes and prealloc extents with send

This test verifies that after an incremental btrfs send the
replicated file has the same exact hole and data structure as in
the origin filesystem. This didn't use to be the case before the
send stream version 2 - holes were sent as write operations of 0
valued bytes instead of punching holes with the fallocate system
call, and pre-allocated extents were sent as well as write
operations of 0 valued bytes instead of intructions for the
receiver to use the fallocate system call.

It also checks that prealloc extents that lie beyond the file's
size are replicated by an incremental send.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agorenameat2 syscall: turn EEXIST into ENOTEMPTY
Miklos Szeredi [Wed, 16 Apr 2014 00:19:02 +0000 (10:19 +1000)]
renameat2 syscall: turn EEXIST into ENOTEMPTY

XFS is returning EEXIST rather than ENOTEMPTY for several of
these rename tests. The rename man page says this about the errors:

       ENOTEMPTY or EEXIST
              newpath is a nonempty directory, that is, contains
              entries other than "." and "..".

Which implies that both errors are valid and so the test should pass
in either case.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agogeneric: add renameat2 system call number for i386
Theodore Ts'o [Wed, 16 Apr 2014 00:18:41 +0000 (10:18 +1000)]
generic: add renameat2 system call number for i386

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agogeneric/024: fix output number
Dave Chinner [Mon, 14 Apr 2014 01:19:23 +0000 (11:19 +1000)]
generic/024: fix output number

Didn't update a patch correctly when renumbering it. This time
on a test that doesn't run on XFS yet, so it avoided smoke tests...

Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agogeneric: add renameat2 system call number for i386
Theodore Ts'o [Mon, 14 Apr 2014 00:45:02 +0000 (10:45 +1000)]
generic: add renameat2 system call number for i386

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agogeneric/004: fix filtering of expected error message
Theodore Ts'o [Mon, 14 Apr 2014 00:37:33 +0000 (10:37 +1000)]
generic/004: fix filtering of expected error message

The failure message goes to stderr, so we need to redirect stderr to
stdout before running sed.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agogeneric/311: add fallocate() check
Eric Whitney [Mon, 14 Apr 2014 00:37:33 +0000 (10:37 +1000)]
generic/311: add fallocate() check

Generic/311 fails when run on a test filesystem that does not
support fallocate().  Its I/O load is produced by fsync-tester,
which uses fallocate() system calls to allocate blocks for some of
its test cases.  This causes EOPNOTSUPP failures when the test is
run on indirect block-mapped ext4 filesystems.

Verify that the test filesystem supports fallocate() before
proceeding with the test, checking for block allocation
capabilities.  Also, fix a minor error message typo.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agogeneric/300: add fallocate() checks
Eric Whitney [Mon, 14 Apr 2014 00:37:32 +0000 (10:37 +1000)]
generic/300: add fallocate() checks

Generic/300 fails when run on a test filesystem that does not
support fallocate(). It uses fio's falloc ioengine to generate part
of its I/O load and both allocates blocks and punches holes.  This
causes EOPNOTSUPP failures when the test is run on indirect
block-mapped ext4 filesystems or pre-3.14 ext4 filesystems created
with bigalloc.

Verify that the test filesystem supports fallocate() before
proceeding with the test, checking for both block allocation and
hole punching capabilities.  Also, delete any pre-existing test
output.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agogeneric: check cross renameat2 syscall
Miklos Szeredi [Mon, 14 Apr 2014 00:37:32 +0000 (10:37 +1000)]
generic: check cross renameat2 syscall

Check with RENAME_EXCHANGE flag.  This flag indicates that the
source and destination files are to be exchanged.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agogeneric: check noreplace renameat2 syscall
Miklos Szeredi [Mon, 14 Apr 2014 00:37:31 +0000 (10:37 +1000)]
generic: check noreplace renameat2 syscall

Check with RENAME_NOREPLACE flag.  This flag indicates that the
rename must fail if the target of the rename exists.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agogeneric: check plain renameat2 syscall
Miklos Szeredi [Mon, 14 Apr 2014 00:35:27 +0000 (10:35 +1000)]
generic: check plain renameat2 syscall

Check with zero flags.  This is what rename(2) and renameat(2) now
call, so this actually tests the behavior of these syscalls as well.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agocommon: add infrastructure for renameat2 syscall tests
Miklos Szeredi [Mon, 14 Apr 2014 00:34:51 +0000 (10:34 +1000)]
common: add infrastructure for renameat2 syscall tests

The renameat2() syscall was merged into 3.15-rc (merge commit:
7df934526c0b).

This adds the shared infrastructure for the actual test scripts.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agoconfig: Add -s option to run only specified sections
Lukas Czerner [Fri, 11 Apr 2014 00:19:29 +0000 (10:19 +1000)]
config: Add -s option to run only specified sections

This commit adds -s option which allows you to specify only certain
sections from the config file to be run. The '-s' argument can be
specified multiple times to allow multiple sections to be run.

The options are still carried between section, that includes the
sections which are not going to be run.

Update README.config-sections as well.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agogeneric/022: Fix output file
Lukas Czerner [Fri, 11 Apr 2014 00:18:20 +0000 (10:18 +1000)]
generic/022: Fix output file

In commit 21723cdb, renumbering the test wasn't completed entirely,
leaving the output file with a wrong test number. It should be 022,
fix it.

[dchinner: Yup, my mistake. editted the commit message to reflect
 that.]

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agogeneric/204: correct log size for XFS
Alexander Tsvetkov [Fri, 11 Apr 2014 00:10:25 +0000 (10:10 +1000)]
generic/204: correct log size for XFS

generic/204 fails on device with Advanced Format of 4096 bytes per
physical sector and when partition starts at the 4K boundary/./In
this case filesystem sector/block size will be of 4096 bytes size
and _scratch_mkfs_sized fails because mkfs reports that 5Mb log size
is not enough to create a filesystem, for example attempt to make
filesystem on such partition:

mkfs.xfs -f -bsize=4096 -l size=5m -d size=109051904 /dev/sdb2"

results to:

"log size 1280 blocks too small, minimum size is 1605 blocks"

and generic/204 fails with ENOSPC before it has finished creating
the necessary files. Log size of 7MB is enough for this test to pass.

Signed-off-by: Alexander Tsvetkov <alexander.tsvetkov@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agoconfig: fix specifying configuration value with equality sign
Lukas Czerner [Fri, 11 Apr 2014 00:09:48 +0000 (10:09 +1000)]
config: fix specifying configuration value with equality sign

Currently there is a problem with parse_config_section() when the
configuration value contains equality sign like this for example:

MOUNT_OPTIONS="-o data=journal"

the result will be

export MOUNT_OPTIONS="-o data="journal"

which is not going to work. The reason is that the expression used to
parse the configuration options uses greedy matching '.*'. Fix this by
using non greedy expression to match the first equality sign '[^=]'.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agoext4/306: disable 64bit feature too
Eryu Guan [Fri, 11 Apr 2014 00:08:26 +0000 (10:08 +1000)]
ext4/306: disable 64bit feature too

mke2fs ext4 without extent feature will fail if 64bit feature is
enabled in mke2fs.conf

mke2fs 1.42.9 (28-Dec-2013)
Extents MUST be enabled for a 64-bit filesystem.  Pass -O extents to rectify.

So disable 64bit feature together with extent explicitly.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
5 years agocheck: fix wallclock wrapping problem
Wanlong Gao [Tue, 8 Apr 2014 23:55:52 +0000 (09:55 +1000)]
check: fix wallclock wrapping problem

If a test cross two days, the time may be negative, let's use
the UTC seconds instead, for example:

2014-04-03 23:43:42 ./check generic/074 generic/075 generic/112 generic/113 generic/132 generic/133 generic/231
FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 vpx-2 3.14.0-00001-g462fa88
MKFS_OPTIONS  -- -f -bsize=4096 /dev/vdd
MOUNT_OPTIONS -- /dev/vdd /fs/scratch

generic/074  100s
generic/075  220s
generic/112  226s
generic/113  188s
generic/132  18s
generic/133  37s
generic/231  -85401s
Ran: generic/074 generic/075 generic/112 generic/113 generic/132 generic/133 generic/231
Passed all 7 tests

Reported-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>