xfstests-dev.git
9 years agoxfs/087: give quota mount option per filesystem
Jaegeuk Kim [Thu, 12 Feb 2015 03:22:33 +0000 (14:22 +1100)]
xfs/087: give quota mount option per filesystem

This patch add _get_quota_option to assign the mount option selectively.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon/log: add _get_log_configs for testing options
Jaegeuk Kim [Thu, 12 Feb 2015 03:22:11 +0000 (14:22 +1100)]
common/log: add _get_log_configs for testing options

This patch adds _get_log_configs for xfs and f2fs to test several
mount options for:

  xfs/086
* xfs/087

In xfs/087, one more test was added, so 10 tests will be done in
total.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfs/086,087: remove specific testing options in output
Jaegeuk Kim [Thu, 12 Feb 2015 03:21:21 +0000 (14:21 +1100)]
xfs/086,087: remove specific testing options in output

This patch removes the mkfs and mount options specified in output
files in xfs/086 and xfs/087.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: define _require_logstate
Jaegeuk Kim [Thu, 12 Feb 2015 03:20:58 +0000 (14:20 +1100)]
common: define _require_logstate

This patch defines logstate by adding dump.f2fs for f2fs's clean and
dirty logs.  This macro is added into:

  xfs/085
  xfs/086
  xfs/087

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agogeneric: relocate xfs shutdown tests into tests/generic/
Jaegeuk Kim [Thu, 12 Feb 2015 03:20:27 +0000 (14:20 +1100)]
generic: relocate xfs shutdown tests into tests/generic/

This patch moves the generic testcases defined in xfs into
tests/generic/.

  xfs/053 -> generic/042
  xfs/137 -> generic/043
  xfs/138 -> generic/044
  xfs/139 -> generic/045
  xfs/140 -> generic/046
  xfs/179 -> generic/047
  xfs/180 -> generic/048
  xfs/182 -> generic/049
  xfs/200 -> generic/050
  xfs/306 -> generic/051

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: add _require_norecovery
Jaegeuk Kim [Thu, 12 Feb 2015 03:19:37 +0000 (14:19 +1100)]
common: add _require_norecovery

This patch adds checking code whether filesystem supports norecovery
mount option or not.  Use this in the following xfs test.

 xfs/200         (recovery vs ro-block device)

Currently, norecovery mount option is used by xfs only. But some of
log-based filesystems (e.g., f2fs) are able to support it later.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: use fiemap to count extents and holes
Jaegeuk Kim [Thu, 12 Feb 2015 03:18:23 +0000 (14:18 +1100)]
common: use fiemap to count extents and holes

For the follwoing tests, this patch adds general script to get extent and
hole counts.

 xfs/137         (data vs filesize)
 xfs/138         (data vs filesize vs truncate)
 xfs/139         (data vs filesize vs partial truncate)
 xfs/140         (data vs filesize vs extending truncate)
 xfs/179         (data vs filesize w/ fsync)
 xfs/180         (data vs filesize w/ sync)
 xfs/182         (data vs filesize w/ recovery)

It also requires these tests to check for fiemap support.

[dchinner: use _require_xfs_io_command "fiemap" for consistency]

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: add _require_scratch_shtudown
Jaegeuk Kim [Thu, 12 Feb 2015 03:14:52 +0000 (14:14 +1100)]
common: add _require_scratch_shtudown

This is to detect whether filesystem supports shutdown feature or not.
And let use this into the following xfs tests.

 xfs/053         (data exposure)
 xfs/137         (data vs filesize)
 xfs/138         (data vs filesize vs truncate)
 xfs/139         (data vs filesize vs partial truncate)
 xfs/140         (data vs filesize vs extending truncate)
 xfs/179         (data vs filesize w/ fsync)
 xfs/180         (data vs filesize w/ sync)
 xfs/182         (data vs filesize w/ recovery)
 xfs/200         (recovery vs ro-block device)
 xfs/306         (fsstress vs recovery)

 xfs/085
 xfs/086
 xfs/087

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agofsx: check for filesystem support of FALLOCATE_FL_KEEP_SIZE
Anna Schumaker [Thu, 12 Feb 2015 03:14:20 +0000 (14:14 +1100)]
fsx: check for filesystem support of FALLOCATE_FL_KEEP_SIZE

The NFS implementation of fallocate() does not support passing the
KEEP_SIZE flag by itself, causing tests to randomly fail.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: add regression test for remount with thread_pool resized
Xing Gu [Thu, 12 Feb 2015 03:14:00 +0000 (14:14 +1100)]
btrfs: add regression test for remount with thread_pool resized

Regression test for a btrfs issue of resizing 'thread_pool' when
remount the fs.

This regression was introduced by the following linux kernel commit:
    btrfs: Added btrfs_workqueue_struct implemented ordered
    execution based on kernel workqueue
    08a9ff3264181986d1d692a4e6fce3669700c9f8
And it was fixed by the following linux kernel commit:
    btrfs: fix crash in remount(thread_pool=) case
    800ee2247f483b6d05ed47ef3bbc90b56451746c

Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoext4/304: ignore EINVAL and ENODATA error
Xiaoguang Wang [Thu, 12 Feb 2015 03:13:44 +0000 (14:13 +1100)]
ext4/304: ignore EINVAL and ENODATA error

ext4/304 is also ext4 defragmentation stress test, which creates several
threads to perform defragmentation using 'inplace' mode, but there is a
possible race that the donor file has been truncated by thread_A, while
thread_B starts to call ioctl(EXT4_IOC_MOVE_EXT), then we may get a
EINVAL or ENODATA error.

Please see: http://www.spinics.net/lists/linux-ext4/msg46900.html for
detailed information.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: helper to print raw byte output from qgroup show
David Sterba [Thu, 12 Feb 2015 03:13:15 +0000 (14:13 +1100)]
common: helper to print raw byte output from qgroup show

Newer versions of btrfs-progs change the default output of 'qgroup
show', we have to check what version is running and use the right option
if needed.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfs: xfs_repair secondary sb verification regression test
Brian Foster [Thu, 12 Feb 2015 03:12:14 +0000 (14:12 +1100)]
xfs: xfs_repair secondary sb verification regression test

The secondary superblock verification in xfs_repair was subject to a bug
that unnecessarily leads to a brute force superblock scan if the last
superblock in the fs happens to be corrupt. Normally, xfs_repair handles
one-off superblock corruption gracefully using a heuristic that finds
the most consistent superblock content across the set of secondary
superblocks.

Create a regression test for xfs_repair that corrupts the last
superblock in the fs. Verify the superblock is updated from the
previously verified sb content and a brute force scan is not initiated.
In the event of failure, detect that a brute force scan has started and
abort the repair in order to fail the test quickly.

To support the test, extend the xfs_repair filter to handle corrupted
superblock repair output and provide generic test output for arbitrary
AG counts.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoshared/032: handle mkfs.* in either /sbin or /usr/sbin
Eric Sandeen [Thu, 12 Feb 2015 03:11:04 +0000 (14:11 +1100)]
shared/032: handle mkfs.* in either /sbin or /usr/sbin

mkfs executables may live in either /sbin or /usr/sbin, and
the current regexp in this test only catches the former,
and so the test won't run properly with the latter.

Fix this by filtering out whatever was found as
${MKFS_PROG}, rather than a hard-coded /sbin/mkfs path.

Because the list was generated by using a wildcard
with ${MKFS_PROG}.* this will always be the correct filter.

Reported-by: Boaz Harrosh <boaz@plexistor.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfs: add test for XFS_IOC_FSSETXATTR behaviour
Iustin Pop [Wed, 11 Feb 2015 05:54:16 +0000 (16:54 +1100)]
xfs: add test for XFS_IOC_FSSETXATTR behaviour

Adds a new test that checks for correct behaviour of
XFS_IOC_FSSETXATTR for directories: extent sizes should always be
settable on a directory, even if the directory already has allocated
extents.

Signed-off-by: Iustin Pop <iustin@k1024.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoext4/30[23]: ignore EBUSY error
Xiaoguang Wang [Wed, 21 Jan 2015 05:19:33 +0000 (16:19 +1100)]
ext4/30[23]: ignore EBUSY error

xfstests ext4/302, ext4/303 are ext4 defragmentation stress test,
which will ioctl(EXT4_IOC_MOVE_EXT), so EBUSY is expected to happen,
for example, when page's corresponding buffer_head's state is BH_Dirty.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Acked-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: add _disable_dmesg_check function
Eryu Guan [Wed, 21 Jan 2015 05:19:33 +0000 (16:19 +1100)]
common: add _disable_dmesg_check function

Introduce _disable_dmesg_check function, which can be called by tests
that generate WARNINGs etc. on purpose, so the tests won't fail
_dmesg_check.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocheck: check dmesg log after each test
Eryu Guan [Wed, 21 Jan 2015 05:19:33 +0000 (16:19 +1100)]
check: check dmesg log after each test

Check kernel BUG, WARNING etc. in dmesg log after each test and fail the
test if something is found. dmesg log can be found at result dir.

This check now depends on the logging of running tests in dmesg, so this
check can be done without clearing dmesg buffer nor dumping all dmesg to
a file, which can potentially eat all free space on testing host.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocheck: log running test to dmesg
Eric Sandeen [Wed, 21 Jan 2015 05:19:33 +0000 (16:19 +1100)]
check: log running test to dmesg

We already log the running test to system logs via "logger"
but viro pointed out that we can use /dev/kmsg to insert it
into dmesg as well.  When looking at the serial console that
could be pretty useful.

Thanks to viro for the test -w suggestion too.

[Eryu Guan adds timestamp to dmesg too]

Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs/017: support all possible page sizes
Filipe Manana [Wed, 21 Jan 2015 05:19:21 +0000 (16:19 +1100)]
btrfs/017: support all possible page sizes

Currently this test fails on 2 situations:

1) The scratch device supports trim/discard. In this case any modern
   version of mkfs.btrfs outputs a message (to stderr) informing that
   a trim is performed, which the golden output doesn't expect:

   btrfs/017  - output mismatch (see /git/xfstests/results//btrfs/017.out.bad)
       --- tests/btrfs/017.out 2015-01-06 11:14:22.730143144 +0000
       +++ /git/xfstests/results//btrfs/017.out.bad 2015-01-14 22:33:01.582195719 +0000
       @@ -1,4 +1,5 @@
        QA output created by 017
       +Performing full device TRIM (100.00GiB) ...
        wrote 8192/8192 bytes at offset 0
          XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
        4096 4096
        ...
        (Run 'diff -u tests/btrfs/017.out /git/xfstests/results//btrfs/017.out.bad'  to see the entire diff)

    So like others tests do, just redirect mkfs' standard error.

2) On platforms with a page size greater than 4Kb. At the moment btrfs
   doesn't support a node/leaf size smaller than the page size, but it
   supports a larger one. So use the max supported node size (64Kb) so
   that the test runs on any platform currently supported by Linux.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agogeneric: test fsync on inode with many hard links differently
Filipe Manana [Wed, 21 Jan 2015 05:01:25 +0000 (16:01 +1100)]
generic: test fsync on inode with many hard links differently

This test is motivated by an fsync issue discovered in btrfs.
The steps to trigger the issue were:

1) remove an hard link from an inode with a large number of hard links;
2) add a new hard link;
3) add another hard link with the same name as the one removed in step 1;
4) fsync the inode.

These steps made the btrfs fsync log replay fail (with the -EOVERFLOW
error), making the filesystem unmountable, requiring the use of
btrfs-zero-log (it wipes the fsync log) in order to make the filesystem
mountable again (but losing some data/metadata).

The btrfs issue was fixed by the following linux kernel patches:

  Btrfs: fix fsync when extend references are added to an inode
  Btrfs: fix fsync log replay for inodes with a mix of regular refs and extrefs

This issue was present in btrfs since the extrefs (extend references)
feature was added (2012).

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agogeneric: test fsync on inode with many hard links
Filipe Manana [Wed, 21 Jan 2015 05:00:01 +0000 (16:00 +1100)]
generic: test fsync on inode with many hard links

This test is motivated by an fsync issue discovered in btrfs.
The issue in btrfs was that adding a new hard link to an inode that
already had a large number of hardlinks and fsync the inode, would
make the fsync log replay code update the inode with a wrong link count
(smaller than the correct value). This resulted later in dangling
directory index entries, after removing most of the hard links
(correct_value - wrong_value), that were visible to user space but it
was impossible to delete them or do any other operation on them (since
they pointed to an inode that didn't exist anymore, resulting in -ESTALE
errors).

The btrfs issue was fixed by the following linux kernel patch:

   Btrfs: fix fsync when extend references are added to an inode

This issue was present in btrfs since the extrefs (extend references)
feature was added (2012).

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agogeneric: test fsync after unlink
Filipe Manana [Wed, 21 Jan 2015 04:58:23 +0000 (15:58 +1100)]
generic: test fsync after unlink

This test is motivated by an fsync issue discovered in btrfs.
The issue was that after fsyncing an inode that got its link count
decremented, and the new link count is greater than zero, after the
fsync log replay the inode's parent directory metadata became
inconsistent - it had a wrong i_size and dangling index entries which
prevented the directory from ever being removed (rmdir always failed
with -ENOTEMPTY, even if the directory had no more child inodes).

The btrfs issue was fixed by the following linux kernel patch:

    Btrfs: fix directory inconsistency after fsync log replay

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: fix function _require_batched_discard()
Filipe Manana [Wed, 21 Jan 2015 04:57:03 +0000 (15:57 +1100)]
common: fix function _require_batched_discard()

Commit 01d42b7efe3fcb9169befda3072c41d25a87c920 broke the check
for the success status of running fstrim. The [ ] bracets should
have been killed. This made several tests being skipped even when
the test/scratch devices support trim/discard.

For reference:

$ [ fstrim /mnt/ ] || echo foobar
bash: [: fstrim: unary operator expected
foobar

$ fstrim /mnt/ || echo foobar
$ echo $?
0

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfstests: f2fs support
Jaegeuk Kim [Wed, 24 Dec 2014 03:56:26 +0000 (14:56 +1100)]
xfstests: f2fs support

This patch adds to support f2fs file system.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfs/111: fix cp of missing file
Xing Gu [Wed, 24 Dec 2014 03:56:17 +0000 (14:56 +1100)]
xfs/111: fix cp of missing file

After installing the test suite, src directory only contains binary
programs in the final building directory. Here executing "cp src/itrash.c
$SCRATCH_MNT/${I}" will output "cp: cannot stat 'src/itrash.c': No
such file or directory" error message. Fix it.

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>
9 years agoReiser4 initial implementation
Dushan Tcholich [Wed, 24 Dec 2014 03:56:07 +0000 (14:56 +1100)]
Reiser4 initial implementation

Initial xfstests implementation for Reiser4 filesystem.

Signed-off-by: Dushan Tcholich <dusanc@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoext4/004: limit the amount of data written so test runs faster
Theodore Ts'o [Wed, 24 Dec 2014 03:53:10 +0000 (14:53 +1100)]
ext4/004: limit the amount of data written so test runs faster

Previously this test was taking 6-7 minutes, and writing half a
gigabyte of data in the dump/restore test directory.  Change this to
be about 60 megs, and to take ~20 seconds.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocheck: treat _check_{test,scratch}_fs failures as test failures
Eryu Guan [Wed, 24 Dec 2014 03:51:50 +0000 (14:51 +1100)]
check: treat _check_{test,scratch}_fs failures as test failures

Currently if _check_test_fs and/or _check_scratch_fs find corruption,
the test itself is still reported as pass, like

[root@hp-dl388eg8-01 xfstests]# ./check xfs/071 xfs/072
FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 hp-dl388eg8-01 3.18.0-rc7+
MKFS_OPTIONS  -- -f -bsize=4096 /dev/sda6
MOUNT_OPTIONS -- -o context=system_u:object_r:nfs_t:s0 /dev/sda6 /mnt/testarea/scratch

xfs/071  2s
_check_xfs_filesystem: filesystem on /dev/sda6 is inconsistent (r) (see /root/xfstests/results//xfs/071.full)
xfs/072  1s
Ran: xfs/071 xfs/072
Passed all 2 tests

[root@hp-dl388eg8-01 xfstests]# echo $?
0

Usually it's not a problem, but it does confuse scripts that depend on
return value of check. Update check to treat _check_{test,scratch}_fs
failures as test failures too, new test output is like

[root@hp-dl388eg8-01 xfstests]# ./check xfs/071 xfs/072
FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 hp-dl388eg8-01 3.18.0-rc7+
MKFS_OPTIONS  -- -f -bsize=4096 /dev/sda6
MOUNT_OPTIONS -- -o context=system_u:object_r:nfs_t:s0 /dev/sda6 /mnt/testarea/scratch

xfs/071 2s ... 2s
_check_xfs_filesystem: filesystem on /dev/sda6 is inconsistent (r) (see /root/xfstests/results//xfs/071.full)
xfs/072 1s ... 1s
Ran: xfs/071 xfs/072
Failures: xfs/071
Failed 1 of 2 tests

[root@hp-dl388eg8-01 xfstests]# echo $?
1

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: return failure if _check_xxx_filesystem find corruption
Eryu Guan [Wed, 24 Dec 2014 03:51:25 +0000 (14:51 +1100)]
common: return failure if _check_xxx_filesystem find corruption

So the callers could know if these functions find corruptions by the
return value.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: exit only if tests find corruption
Eryu Guan [Wed, 24 Dec 2014 03:51:04 +0000 (14:51 +1100)]
common: exit only if tests find corruption

If _check_xxx_filesystem called by tests when corruption found
they exit, but we don't want the calls from the test harness itself to
exit when corruption is found.

_check_xfs_filesystem already behaves correctly, make
_check_generic_filesystem and _check_btrfs_filesystem follow the same
behavior.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: add test case for qgroup account on shared extents
Liu Bo [Wed, 24 Dec 2014 03:48:23 +0000 (14:48 +1100)]
btrfs: add test case for qgroup account on shared extents

This is a regression test of
'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
it's used to verify that removing shared extents can end up incorrect
qgroup accounting.

It can produce qgroup related warnings.

The fix is https://patchwork.kernel.org/patch/5499981/
"Btrfs: fix a warning of qgroup account on shared extents"

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Tested-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoCheck O_DIRECT support before testing direct I/O
Junho Ryu [Tue, 16 Dec 2014 03:01:06 +0000 (14:01 +1100)]
Check O_DIRECT support before testing direct I/O

Some filesystems do not support O_DIRECT.  Check whether TEST_DIR supports
it by running xfs_io with -d flag.

Signed-off-by: Junho Ryu <jayr@google.com>
Signed-off-by: Dushan Tcholich <dusanc@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agogeneric/038: require fallocate support
Dushan Tcholich [Mon, 15 Dec 2014 23:53:57 +0000 (10:53 +1100)]
generic/038: require fallocate support

Add test for fallocate(2) support

Signed-off-by: Dushan Tcholich <dusanc@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: unify _require_batched_discard
Dushan Tcholich [Mon, 15 Dec 2014 23:53:57 +0000 (10:53 +1100)]
common: unify _require_batched_discard

To check for FITRIM tests used  _require_fstrim() and
_test_batched_discard() but as _test_batched_discard() already
includes _test_fstrim() unify FSTRIM check throughout xfstests with
_require_batched_discard().

Signed-off-by: Dushan Tcholich <dusanc@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoext4/308: require fallocate support
Theodore Ts'o [Mon, 15 Dec 2014 23:53:57 +0000 (10:53 +1100)]
ext4/308: require fallocate support

These tests use the falloc command in xfs_io, and there are some file
systems (ext3) or file system configurations (ext4 in ext3
compatibility mode) which do not support fallocate.  So add the
explicit requirement to avoid false test failures.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: add regression test for clone ioctl
Filipe Manana [Mon, 15 Dec 2014 23:53:42 +0000 (10:53 +1100)]
btrfs: add regression test for clone ioctl

Regression test for a btrfs clone ioctl issue where races between
a clone operation and concurrent target file reads would result in
leaving stale data in the page cache. After the clone operation
finished, reading from the clone target file would return the old
and no longer valid data. This affected only buffered reads (i.e.
didn't affect direct IO reads).

This issue was fixed by the following linux kernel patch:

    Btrfs: ensure readers see new data after a clone operation
    (commit c125b8bff1d9f6c8c91ce4eb8bd5616058c7d510)

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agofstests: btrfs, add test for snapshoting after file write + truncate
Filipe Manana [Mon, 15 Dec 2014 23:50:56 +0000 (10:50 +1100)]
fstests: btrfs, add test for snapshoting after file write + truncate

Regression test for a btrfs issue where if right after the snapshot
creation ioctl started, a file write followed by a file truncate
happened, with both operations increasing the file's size, the created
snapshot would capture an inconsistent state of the file system tree.
That state reflected the file truncation but it didn't reflect the
write operation, and left a gap between two file extent items (and
that gap corresponded to the total or a partial area of the write
operation's range).

This issue was fixed by the following linux kernel patch:

    Btrfs: fix snapshot inconsistency after a file write followed by truncate

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: use mke2fs -F instead of piping in yes
Theodore Ts'o [Mon, 15 Dec 2014 23:50:21 +0000 (10:50 +1100)]
common: use mke2fs -F instead of piping in yes

It's possible based on a race conditions (and possibly the version of
coreutils which supplies /usr/bin/yes) that commands of the form:

yes | $MKFS_PROG ...

will end up causing the following failure:

shared/298 16s ... [23:49:03] [23:49:19] - output mismatch (see /results/results-4k/shared/298.out.bad)
    --- tests/shared/298.out 2014-10-31 10:13:04.000000000 -0400
    +++ /results/results-4k/shared/298.out.bad 2014-11-29 23:49:19.118138099 -0500
    @@ -1,4 +1,6 @@
     QA output created by 298
    +yes: standard output: Broken pipe
    +yes: write error
     Generating garbage on loop...done.
     Running fstrim...done.
     Detecting interesting holes in image...done.
    ...
    (Run 'diff -u tests/shared/298.out /results/results-4k/shared/298.out.bad'  to see the entire diff)

Using mke2fs's -F option instad of "yes | $MKFS_PROG" fixes this issue.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agogeneric/299: make sure fio really exits
Eryu Guan [Mon, 15 Dec 2014 23:49:57 +0000 (10:49 +1100)]
generic/299: make sure fio really exits

Fix two problems in generic/299

1. Remove $seqres.full before test, otherwise the file is growing all
the time.

2. Make sure fio really exits, otherwise fio would block umount. $pid is
the pid of function run_check not fio, sometimes fio is still there when
$pid is dead and blocking umount.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocifs: add missing Makefile
David Disseldorp [Mon, 15 Dec 2014 23:48:51 +0000 (10:48 +1100)]
cifs: add missing Makefile

This fixes the make install target, which traverses all tests/*
subdirectories.

Reported-by: David Drysdale <drysdale@google.com>
Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: add groups for btrfs tests
Eryu Guan [Mon, 15 Dec 2014 23:48:35 +0000 (10:48 +1100)]
btrfs: add groups for btrfs tests

Some new btrfs groups have been added in the btrfs stress patchset, add
other tests to proper groups too.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoext4: the _require checks for bigalloc need a larger fs size
Vishal Verma [Fri, 12 Dec 2014 00:26:56 +0000 (11:26 +1100)]
ext4: the _require checks for bigalloc need a larger fs size

_require_ext4_bigalloc and _require_ext4_mkfs_bigalloc create a
200k fs. DAX (as XIP before it) relies on a fs block size ==
system page size; ie 4k for us.  With a 200k fs size limit,
mkfs refuses to create a filesystem with a 4k block size, so
the check fails, but for a bogus reason.
Increasing the fs size to 512m allows mkfs to create a filesystem
with 4k block size, so the test passes.

Signed-off-by: Vishal Verma <vishal.l.verma@linux.intel.com>
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: fix comment about _require_test
Eryu Guan [Fri, 12 Dec 2014 00:26:45 +0000 (11:26 +1100)]
common: fix comment about _require_test

_require_test will mount test dev if not mounted, fix the comment to
reflect that.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs/017: remove duplicate test
Eryu Guan [Fri, 12 Dec 2014 00:26:31 +0000 (11:26 +1100)]
btrfs/017: remove duplicate test

btrfs/017 is same as btrfs/015, remove it.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agofstests: change mode of test files to 0755
Eryu Guan [Fri, 12 Dec 2014 00:26:15 +0000 (11:26 +1100)]
fstests: change mode of test files to 0755

Performed by

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

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfs/071: remove xfs/071.out from git
Eryu Guan [Fri, 12 Dec 2014 00:25:47 +0000 (11:25 +1100)]
xfs/071: remove xfs/071.out from git

xfs/071.out is supposed to linked to the right out file at run time.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocifs: add server-side copy sanity test
David Disseldorp [Fri, 12 Dec 2014 00:24:10 +0000 (11:24 +1100)]
cifs: add server-side copy sanity test

This test uses the cloner binary to issue CIFS_IOC_COPYCHUNK_FILE
server-side copy requests.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Acked-by: Steve French <smfrench@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: rename _require_btrfs_cloner to _require_cloner
David Disseldorp [Fri, 12 Dec 2014 00:23:06 +0000 (11:23 +1100)]
common: rename _require_btrfs_cloner to _require_cloner

src/cloner.c is no longer Btrfs specific, so use a generic name.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Acked-by: Steve French <smfrench@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: add test to stress chunk allocation/removal and fstrim
Filipe Manana [Fri, 12 Dec 2014 00:07:22 +0000 (11:07 +1100)]
btrfs: add test to stress chunk allocation/removal and fstrim

Stress btrfs' block group allocation and deallocation while running
fstrim in parallel. Part of the goal is also to get data block groups
deallocated so that new metadata block groups, using the same physical
device space ranges, get allocated while fstrim is running. This caused
several issues ranging from invalid memory accesses, kernel crashes,
metadata or data corruption, free space cache inconsistencies, free
space leaks and memory leaks.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoext4: add dump/restore test
Xiaoguang Wang [Thu, 11 Dec 2014 23:56:26 +0000 (10:56 +1100)]
ext4: add dump/restore test

This test case will first use fsstress to fill a file system, then
dump it to standard output and restore it from standard input, finally
check that the original contents and the new contents generated by
restore tool will be same.

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>
9 years agocommon: update README to list build dependencies
Steve French [Thu, 11 Dec 2014 23:55:29 +0000 (10:55 +1100)]
common: update README to list build dependencies

Add sample list of packages (dependencies) required to build XFSTESTS
and add a step to the instructions to mention creating the test
user needed for some of the ACL tests.

Signed-off-by: Steve French <smfrench@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agogeneric: use xfs_io falloc, not fallocate
Eric Sandeen [Thu, 11 Dec 2014 23:55:24 +0000 (10:55 +1100)]
generic: use xfs_io falloc, not fallocate

generic/315 fails messily if the fallocate command isn't present.

generic/299 also uses "fallocate" and "truncate" binaries which may
not be present.

Switch both to use xfs_io, and we already have the _require for
that, because it's what every other test uses...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfs/096: strip log stripe warnings from mkfs.xfs
Dave Chinner [Thu, 11 Dec 2014 23:55:15 +0000 (10:55 +1100)]
xfs/096: strip log stripe warnings from mkfs.xfs

The warnings have been removed when stripe unit/width are too big
for the log stripe unit to be set. Hence add them to the mkfs.xfs
filter and strip them from golden output file so the test succeeds
on both new and old mfks binaries.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfs: test xfs_copy for various sector and block sizes
Eric Sandeen [Thu, 11 Dec 2014 23:55:15 +0000 (10:55 +1100)]
xfs: test xfs_copy for various sector and block sizes

This tests xfs_copy, copying all combinations of sector
size and block size possible on the platform running the
test.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: enable tests that require scratch device on CIFS
Eryu Guan [Thu, 11 Dec 2014 23:53:55 +0000 (10:53 +1100)]
common: enable tests that require scratch device on CIFS

Just like commit

76c5f3c common: re-enable tests that require scratch dev on NFS

Enable tests that require scratch device on CIFS too to get a better
test coverage.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agogeneric: add test to verify xattr replace operations are atomic
Filipe Manana [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
generic: add test to verify xattr replace operations are atomic

This test verifies that replacing a xattr's value is an atomic
operation. This is motivated by an issue in btrfs where replacing
a xattr's value wasn't an atomic operation, it consisted of
removing the old value and then inserting the new value in a
btree. This made readers (getxattr and listxattrs) not getting
neither the old nor the new value during a short time window.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfs/062: verify bulkstat finds all inodes
Brian Foster [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
xfs/062: verify bulkstat finds all inodes

The bulkstat mechanism is used by xfsdump and other tools to index all
inodes allocated in a filesystem. Run some simple tests with varying
inode layouts and bulkstat batch sizes to verify bulkstat finds the
expected number of inodes.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agogeneric/277: add _require_attrs
Eryu Guan [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
generic/277: add _require_attrs

NFS doesn't support attr yet, add _require_attrs in generic/277 to
avoid failure when testing on NFS.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: use _scratch_mount helper in _require_relatime()
Eryu Guan [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
common: use _scratch_mount helper in _require_relatime()

Change the way how _require_relatime() mount $SCRATCH_DEV, use
_scratch_mount helper so $SCRATCH_DEV is mounted with selinux context,
to avoid "same superblock, different selinux context" failure.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agogeneric: skip atime related tests on NFS
Eryu Guan [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
generic: skip atime related tests on NFS

From nfs(5) we can know that atime related mount options have no
effect on NFS mounts, so add _require_atime() helper to skip atime
tests on NFS

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: add _require_block_device() helper
Eryu Guan [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
common: add _require_block_device() helper

Add _require_block_device() helper and use it in _require_dm_flakey()
and generic/076.

_require_dm_flakey() assumes $SCRATCH_DEV is a block device, now it can
also be a NFS export.

generic/076 does "cat $SCRATCH_DEV" which will fail when testing on NFS.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: re-enable tests that require scratch dev on NFS
Eryu Guan [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
common: re-enable tests that require scratch dev on NFS

Commit c041421 ("xfstests: stop special casing nfs and udf")
disables tests requires scratch dev running on NFS. Add the
infrastructure needed to re-enable them to get a larger test
coverage on NFS.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: Fixes for testing NFS over IPv6
Anna Schumaker [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
common: Fixes for testing NFS over IPv6

When testing NFS over IPv6, the user may set a $TEST_DEV of the form
[fe80::42]:/export.  The use of square brackets surrounding the IPv6
address is an accepted convention, but grep and awk think that our IPv6
address is actually a regex and tries to evaluate it instead.  The
result is that xfstests reports our filesystem "is busy or already
mounted".

This patch fixes the IPv6 problem by telling awk and grep to treat
$TEST_DEV as a fixed string rather than a regex.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfs/068: fix expected output file for proper restore output
Eric Sandeen [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
xfs/068: fix expected output file for proper restore output

Oh my, I did a very bad thing - I wrote a new test to
check for xfsdump regressions, but did not create the
.out file with a known-good kernel.

This matches output from older, stable kernels, and is the
proper expected output.  Sorry about that!

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoaio: add regression test race between write and fcntl
Dmitry Monakhov [Mon, 10 Nov 2014 07:06:19 +0000 (18:06 +1100)]
aio: add regression test race between write and fcntl

perform AIO-DIO and fcntl(F_SETFL) concurently. Unaligned AIO likely
results in synchronization which makes the race window wider.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agofstests: update 'new' script
Dmitry Monakhov [Mon, 10 Nov 2014 07:01:10 +0000 (18:01 +1100)]
fstests: update 'new' script

- Update script to support new test cheme tests/$fs_type/$TEST_IDX
- Try to use first unused ID

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoaio: fix memory corruption in aio-last-ref-held-by-io
Liu Bo [Mon, 10 Nov 2014 07:01:07 +0000 (18:01 +1100)]
aio: fix memory corruption in aio-last-ref-held-by-io

This's been detected by testing generic/323 on btrfs, it keeps
producing chaos of checksum errors.

It is because aio-last-ref-held-by-io uses a static buffer that is
been used repeatedly for every io_submit() call, but we'll issue
NUM_IOS(=16) io_sumbit() in a 'for' loop at a time, and when those
data read by aio has not finish its endio(), its memory is likely to
be used in the next io_submit, which ends up data corruption and
numerous checksum errors.

This allocates memory for each io_submit() and generic/323 runs fine
after this.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfs/195: Use XFSDUMP_PROG instead of xfsdump directly
Jan Kara [Mon, 10 Nov 2014 02:05:22 +0000 (13:05 +1100)]
xfs/195: Use XFSDUMP_PROG instead of xfsdump directly

Use appropriate environment variable (XFSDUMP_PROG) instead of
hardcoding 'xfsdump' name. Also make the test fail graciously when
xfsdump isn't installed.

We also make XFSDUMP_PROG be equal to empty string instead of -e when
xfsdump isn't installed. The changes require some tweaking to output
filtering since full command path now appears in the output.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: regression test for btrfs extent merge
Qu Wenruo [Mon, 10 Nov 2014 02:04:00 +0000 (13:04 +1100)]
btrfs: regression test for btrfs extent merge

The following kernel commit introduced the bug:
51f395ad btrfs: Use right extent length when inserting overlap extent map.

When btrfs commit race with btrfs_get_extent(), merge_extent_mapping()
may build up a new extent which length overflows and cause extent map
insert fail, causing the caller get a -EEXIST error.

This regression is fixed by the following patches:
btrfs: Fix and enhance merge_extent_mapping() to insert best fitted extent map
btrfs: Fix the wrong condition judgment about subset extent map

Cc: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Tested-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: regression test for ro snapshot creation
Filipe Manana [Mon, 10 Nov 2014 02:03:43 +0000 (13:03 +1100)]
btrfs: regression test for ro snapshot creation

Regression test for a btrfs issue where creation of readonly snapshots caused
the filesystem to get into an inconsistent state.

This regression was introduced in the 3.17 kernel and fixed by reverting the
following linux kernel commit:

     Btrfs: race free update of commit root for ro snapshots
     9c3b306e1c9e6be4be09e99a8fe2227d1005effc

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfs: test larger dump/restore to/from file
Eric Sandeen [Tue, 14 Oct 2014 11:59:39 +0000 (22:59 +1100)]
xfs: test larger dump/restore to/from file

This test creates a large-ish directory structure using
fsstress, and does a dump/restore to make sure we dump
all the files.

Without the fix for the regression caused by:
c7cb51d xfs: fix error handling at xfs_inumbers

we will see failures like:

    -xfsrestore: 486 directories and 1590 entries processed
    +xfsrestore: 30 directories and 227 entries processed

as it fails to process all inodes.

I think that existing tests have a much smaller set of files,
and so don't trip the bug.

I don't do a file-by-file comparison here, because for some
reason the diff output gets garbled; this test only checks
that we've dumped & restored the correct number of files.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfs/053: test for stale data exposure via falloc/writeback interaction
Brian Foster [Tue, 14 Oct 2014 11:59:39 +0000 (22:59 +1100)]
xfs/053: test for stale data exposure via falloc/writeback interaction

XFS buffered I/O writeback has a subtle race condition that leads to
stale data exposure if the filesystem happens to crash after delayed
allocation blocks are converted on disk and before data is written back
to said blocks.

Use file allocation commands to attempt to reproduce a related, but
slightly different variant of this problem. The associated falloc
commands can lead to partial writeback that converts an extent larger
than the range affected by falloc. If the filesystem crashes after the
extent conversion but before all other cached data is written to the
extent, stale data can be exposed.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: regression test for btrfs incremental send
Filipe Manana [Tue, 14 Oct 2014 11:59:39 +0000 (22:59 +1100)]
btrfs: regression test for btrfs incremental send

This is a regression test for a btrfs incremental send issue.
If between two snapshots we rename an existing directory named X to Y and
make it a child (direct or not) of a new inode named X, we were delaying
the move/rename of the former directory unnecessarily, which would result
in attempting to rename the new directory from its orphan name to name X
prematurely. This made btrfs receive fail with an error message like the
following:

   rename o261-7-0 -> merlin/RC/OSD failed

This issue was a regression in the 3.16 kernel and got fixed by the
following linux kernel btrfs patch:

   Btrfs: send, don't delay dir move if there's a new parent inode

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoshared/032: fix fsck failure
Wang Shilong [Tue, 14 Oct 2014 11:59:39 +0000 (22:59 +1100)]
shared/032: fix fsck failure

while running ./check tests/shared/032, it outputs something like:

FSTYP         -- btrfs
PLATFORM      -- Linux/x86_64 vm01 3.17.0-rc5+
MKFS_OPTIONS  -- /dev/sdc
MOUNT_OPTIONS -- /dev/sdc /mnt/scratch

shared/032 2s ... 2s
_check_btrfs_filesystem: filesystem on /dev/sdc is inconsistent (see /root/xfstests-dev/results//shared/032.full)
Ran: shared/032
Passed all 1 tests

This is because xfstests will run fsck after each unit test,
for tests/shared/032, we have reformated SCRATCH_DEV to other fs,
fix this problem by skipping fsck here.

Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: Re-enable testing over NFS
Anna Schumaker [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
common: Re-enable testing over NFS

83ef157 (common: Check fs consistency on TEST_DEV only when needed) has
_require_test unconditionally return _notrun when testing on an NFS
filesystem, essentially disabling NFS.  This patch changes the code to
validate $TEST_DEV and only call _notrun if validation fails.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfs/262: update filter to deal with long device name correctly
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
xfs/262: update filter to deal with long device name correctly

If the device name is too long, the output of xfs_quota -c "df" will be
broke into two lines as

Filesystem           1K-blocks       Used  Available  Use% Pathname
/dev/mapper/rhel_hp--dl388eg8--01-testlv2
                      15718400      32932   15685468    0% /mnt/testarea/scratch
/dev/mapper/rhel_hp--dl388eg8--01-testlv2
                        512000          0     512000    0% /mnt/testarea/scratch/test

and _filter_quota_rpt() couldn't catch the correct available number and
test will fail as

[root@hp-dl388g8-01 xfstests]# diff -u tests/xfs/262.out /root/xfstests/results//xfs/262.out.bad
--- tests/xfs/262.out   2014-10-08 20:16:19.000000000 +0800
+++ /root/xfstests/results//xfs/262.out.bad  2014-10-09 14:29:38.795813323 +0800
@@ -1,2 +1,4 @@
 QA output created by 262
 Silence is golden.
+hard limit 0 bytes, expected 524288000
+hard limit 0 bytes, expected 524288000

Update the filter so it could catch the correct value.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs/010: use _extent_count() helper
Wang Shilong [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs/010: use _extent_count() helper

cleanup to swith _extent_count(), this way we remove a
dependence on filefrag.

Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: add regression for inode bad compression ratio detection
Wang Shilong [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: add regression for inode bad compression ratio detection

This test add a regression test to make sure btrfs dosen't set
inode NOCOMPRESS flag when a small write(<=blocksize) happens.

Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: test mount btrfs subvolume with selinux context
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: test mount btrfs subvolume with selinux context

If one subvolume was mounted with selinux context, other subvolumes
should be able to be mounted with the same selinux context too.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agocommon: fix test for ltp/fsstress
Wang Shilong [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
common: fix test for ltp/fsstress

Testing if FSSTRESS_PROG is a null string dosen't make sense because
it has just been set.

Here fix it by testing if it is an executable file.

Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: new case to run defrag and remount with different compress algorithms simultan...
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run defrag and remount with different compress algorithms simultaneously

Run btrfs defrag operations and remount with different compress
algorithms simultaneously with fsstress running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: new case to run btrfs scrub and remount with different compress algorithms...
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run btrfs scrub and remount with different compress algorithms simultaneously

Run btrfs scrub and remount with different compress algorithms
simultaneously with fsstress running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: new case to run btrfs scrub and defrag operations simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run btrfs scrub and defrag operations simultaneously

Run btrfs scrub and defrag operations simultaneously with fsstress
running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: new case to run device replace and remount with different compress algorithms...
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run device replace and remount with different compress algorithms simultaneously

Run btrfs replace operations and remount with different compress
algorithms simultaneously with fsstress running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: new case to run device replace and defrag operations simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run device replace and defrag operations simultaneously

Run btrfs replace operations and defrag simultaneously with fsstress
running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: new case to run device replace and scrub operations simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run device replace and scrub operations simultaneously

Run btrfs replace operations and scrub simultaneously with fsstress
running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: new case to run subvolume create/delete and remount with defferent compress...
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run subvolume create/delete and remount with defferent compress algorithms

Run btrfs subvolume create/mount/umount/delete and remount with
different compress algorithms simultaneously, with fsstress running in
background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: new case to run btrfs subvolume create/delete and defrag operations simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run btrfs subvolume create/delete and defrag operations simultaneously

Run btrfs subvolume create/mount/umount/delete and btrfs defrag
operations simultaneously, with fsstress running in backgound.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: new case to run btrfs subvolume create/delete operations and scrub simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run btrfs subvolume create/delete operations and scrub simultaneously

Run btrfs subvolume create/mount/umount/delete and btrfs scrub
operation simultaneously, with fsstress running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: new case to run btrfs subvolume create/delete operations and device replace...
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run btrfs subvolume create/delete operations and device replace simultaneously

Run btrfs subvolume create/mount/umount/delete and device replace
operation simultaneously, with fsstress running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: new case to run btrfs balance and device replace operations simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:37 +0000 (22:59 +1100)]
btrfs: new case to run btrfs balance and device replace operations simultaneously

Run btrfs balance and replace operations simultaneously with fsstress
running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: new case to run btrfs balance and remount with different compress algorithms
Eryu Guan [Tue, 14 Oct 2014 11:59:37 +0000 (22:59 +1100)]
btrfs: new case to run btrfs balance and remount with different compress algorithms

Run btrfs balance and remount with different compress algorithms
simultaneously, with fsstress running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: new test to run btrfs balance and defrag operations simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:37 +0000 (22:59 +1100)]
btrfs: new test to run btrfs balance and defrag operations simultaneously

Run btrfs balance and defrag operations simultaneously with fsstress
running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: new test to run btrfs balance and scrub simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:37 +0000 (22:59 +1100)]
btrfs: new test to run btrfs balance and scrub simultaneously

Run btrfs balance and scrub operations simultaneously with fsstress
running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agobtrfs: new test to run btrfs balance and subvolume test simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:37 +0000 (22:59 +1100)]
btrfs: new test to run btrfs balance and subvolume test simultaneously

Run btrfs balance and subvolume create/mount/umount/delete simultaneously,
with fsstress running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfs/287: Make test fail graciously when xfsdump isn't installed
Jan Kara [Tue, 14 Oct 2014 11:59:37 +0000 (22:59 +1100)]
xfs/287: Make test fail graciously when xfsdump isn't installed

Include common/dump into xfs/287 so that the test fails graciously when
xfsdump isn't installed.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agoxfs/007: check correct quota inodes
Dave Chinner [Tue, 14 Oct 2014 06:40:34 +0000 (17:40 +1100)]
xfs/007: check correct quota inodes

Commit b8cac56 ("xfs/007: add project quota Q_XQUOTARM test") has
been broken since it was added - the new code checked the group
quota inode rather than the project quota inode and so always
reported a pre-RM block count of zero.  This occurred due to a copy
and paste of the existing user/group test code and didn't fix up all
the code properly.

Factor the common code into a single function, and pass in the
correct variables the tests require. While there, make sure that we
remove the 007.full file before the test starts to aid future
debugging and also check that project quotas are supported before
trying to test them.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agogeneric: check overwriting rename
Miklos Szeredi [Tue, 14 Oct 2014 06:40:34 +0000 (17:40 +1100)]
generic: check overwriting rename

This tests whether the file or directory overwritten by rename is properly
removed (nlink is zero).

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Dave Chinner <david@fromorbit.com>
9 years agogeneric/017: Do not create file systems with different block sizes
Lukas Czerner [Tue, 14 Oct 2014 06:40:32 +0000 (17:40 +1100)]
generic/017: Do not create file systems with different block sizes

User takes care about specifying mkfs options he wishes to test and the
test itself should not change it if it's not strictly necessary for the
test itself.

In this case it is not necessary and we should only test configuration
provided by the user. Moreover if the block size was already specified
some mkfs utilities does not handle multiple of the same parameters and
the mkfs utility fails making it re-try with only provided options
(ignoring what user specified), which is wrong.

In this case it's also a problem for btrfs file system which does not
support block size < page size.

Fix it by removing the mkfs, and testing existing configuration only.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>