xfstests-dev.git
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 years agoconfig: Fix setting FSTYP automatically
Lukas Czerner [Tue, 8 Apr 2014 23:55:52 +0000 (09:55 +1000)]
config: Fix setting FSTYP automatically

Currently if the FSTYP is not set, the code to get FSTYP using blikd
would not work. This is because we're using HOSTOS environment variable
which might not be set (at least not on my system) and because it's
already late in the code path.

Fix this by using OSTYP environment variable as a fallback in the case
that HOSTOS does not work and move the check to common/config.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Tested-by: Filipe David Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoconfig: Unset SCRATCH_DEV when deduced from SCRATCH_DEV_POOL
Lukas Czerner [Tue, 8 Apr 2014 23:55:52 +0000 (09:55 +1000)]
config: Unset SCRATCH_DEV when deduced from SCRATCH_DEV_POOL

In the case that we already have sections in the config file we
have to make sure that we unset SCRATCH_DEV if it has been deduced from
the SCRATCH_DEV_POOL so that it does not complain about SCRATCH_DEV in
this case.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Tested-by: Filipe David Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoconfig: Fix SCRATCH_DEV_POOL handling
Lukas Czerner [Tue, 8 Apr 2014 23:55:50 +0000 (09:55 +1000)]
config: Fix SCRATCH_DEV_POOL handling

With changes introduced in 667308dd97bf41382d4ab299fa5b56c235cfeb27
it is no longer possible to use SCRATCH_DEV_POOL variable because of
error:

 common/config: Error: $SCRATCH_DEV should be unset when
 $SCRATCH_DEV_POOL is set

This was because get_next_config() would get called twice and hence it
would complain on the second run that SCRATCH_DEV is already set. Fix
it by making sure that we call get_next_config() only once if there
are no sections in the config file.

Also make sure that we export SCRATCH_DEV in the case we're deducing it
from SCRATCH_DEV_POOL.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reported-by: Filipe David Manana <fdmanana@gmail.com>
Tested-by: Filipe David Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: fix RESULT_BASE typo in check script
Eric Sandeen [Fri, 4 Apr 2014 06:24:23 +0000 (17:24 +1100)]
check: fix RESULT_BASE typo in check script

RESULT_BASE is what is set & tested, but RESULTS_BASE was
being used in an error message.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofsstress: Add fallocate collapse range operation
Lukas Czerner [Fri, 4 Apr 2014 06:23:14 +0000 (17:23 +1100)]
fsstress: Add fallocate collapse range operation

This commit adds collapse operation support for fsstress, which is
meant to exercise fallocate FALLOC_FL_COLLAPSE_RANGE support.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofsx: Add fallocate collapse range operation
Lukas Czerner [Fri, 4 Apr 2014 06:22:29 +0000 (17:22 +1100)]
fsx: Add fallocate collapse range operation

This commit adds fallocate FALLOC_FL_COLLAPSE_RANGE support for fsx.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add test for btrfs incremental send data corruption
Filipe David Borba Manana [Fri, 4 Apr 2014 06:20:52 +0000 (17:20 +1100)]
btrfs: add test for btrfs incremental send data corruption

Regression test for the btrfs incremental send feature, where the kernel
would incorrectly consider a range of a file as a hole and send a stream
of 0 bytes to the destination (send stream) that would overwrite the
corresponding file region.

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

   Btrfs: send, fix data corruption due to incorrect hole detection
   (https://patchwork.kernel.org/patch/3910081/)

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>
8 years agofs: add directories hash collision test
Hannes Frederic Sowa [Fri, 4 Apr 2014 06:19:28 +0000 (17:19 +1100)]
fs: add directories hash collision test

This tests creates several directories that have the same small (8)
group of hashes to ensure the hash ordering of file and directories
are preserved.

Sample backtrace this test tries to prevent in future:

[ 3856.245843] XFS (vda1): Internal error xfs_trans_cancel at line 966 of file fs/xfs/xfs_trans.c.  Caller 0xffffffffa01186bc
[ 3856.249049] CPU: 1 PID: 866 Comm: rm Not tainted 3.13.6-200.fc20.x86_64 #1
[ 3856.250966] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 3856.252615]  000000000000000c ffff8800d23a7d68 ffffffff8168730c ffff8800cf5462b8
[ 3856.254823]  ffff8800d23a7d80 ffffffffa00d00cb ffffffffa01186bc ffff8800d23a7da8
[ 3856.257241]  ffffffffa00e5459 ffff8800d9ac3400 ffff8800d23a7e30 ffff8800371b6800
[ 3856.259420] Call Trace:
[ 3856.260172]  [<ffffffff8168730c>] dump_stack+0x45/0x56
[ 3856.261717]  [<ffffffffa00d00cb>] xfs_error_report+0x3b/0x40 [xfs]
[ 3856.263472]  [<ffffffffa01186bc>] ? xfs_remove+0x1ac/0x370 [xfs]
[ 3856.270838]  [<ffffffffa00e5459>] xfs_trans_cancel+0xd9/0x100 [xfs]
[ 3856.272783]  [<ffffffffa01186bc>] xfs_remove+0x1ac/0x370 [xfs]
[ 3856.274531]  [<ffffffffa00db40b>] xfs_vn_unlink+0x4b/0x90 [xfs]
[ 3856.276286]  [<ffffffff811c61b8>] vfs_rmdir+0xa8/0x100
[ 3856.277821]  [<ffffffff811c638d>] do_rmdir+0x17d/0x1d0
[ 3856.281021]  [<ffffffff811ba7fe>] ? ____fput+0xe/0x10
[ 3856.285261]  [<ffffffff8108c11c>] ? task_work_run+0xac/0xe0
[ 3856.286952]  [<ffffffff81013a31>] ? do_notify_resume+0x61/0xa0
[ 3856.288693]  [<ffffffff811c9a65>] SyS_unlinkat+0x25/0x40
[ 3856.290407]  [<ffffffff816962e9>] system_call_fastpath+0x16/0x1b
[ 3856.292685] XFS (vda1): xfs_do_force_shutdown(0x8) called from line 967 of file fs/xfs/xfs_trans.c.  Return address = 0xffffffffa00e5472
[ 3856.627330] XFS (vda1): Corruption of in-memory data detected.  Shutting down filesystem
[ 3856.627332] XFS (vda1): Please umount the filesystem and rectify the problem(s)

With help from Mark Tinguely, thanks very much!

[dchinner: changed binary/test file name to dirhash_collide[.c]]

Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Tested-by: Mark Tinguely <tinguely@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoext4: Make shared/243 ext4 specific
Lukas Czerner [Fri, 4 Apr 2014 06:18:50 +0000 (17:18 +1100)]
ext4: Make shared/243 ext4 specific

The test shared/243 really is ext4 specific even though currently we
would run it on other file systems as well, it would not actually do any
testing.

So move it to ext4 specific directory and rename it to 002.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: Make some shared tests generic
Lukas Czerner [Fri, 4 Apr 2014 06:18:43 +0000 (17:18 +1100)]
generic: Make some shared tests generic

There are couple of tests in shared directory which really should be
made generic, so move it. It is mostly collapse range tests, which
really can be generic to make super we test every file system which adds
collapse range support.

Here is what we're moving in this commit.

shared/001 -> generic/021
shared/002 -> generic/022
shared/003 -> generic/012
shared/004 -> generic/016
shared/005 -> generic/017
shared/218 -> generic/018
shared/305 -> generic/019

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: unmount TEST_DEV and SCRATCH_DEV after test run
Lukas Czerner [Fri, 4 Apr 2014 06:18:32 +0000 (17:18 +1100)]
check: unmount TEST_DEV and SCRATCH_DEV after test run

Unmount TEST_DEV and SCRATCH_DEV after each test run to avoid
mounting multiple devices on the same mount point which might result
in xfstest not being able to unmount the device later down the path.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: Remount file system if MOUNT_OPTIONS changed
Lukas Czerner [Fri, 4 Apr 2014 06:18:24 +0000 (17:18 +1100)]
check: Remount file system if MOUNT_OPTIONS changed

When MOUNT_OPTIONS change we should remount TEST_DEV to put the changes
in effect. This will allow us to have different MOUNT_OPTIONS in sections
in configuration file.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: Allow to recreate TEST_DEV
Lukas Czerner [Fri, 4 Apr 2014 06:18:15 +0000 (17:18 +1100)]
check: Allow to recreate TEST_DEV

Add config option RECREATE_TEST_DEV to allow to recreate file system on
the TEST_DEV device. Permitted values are true and false.

If RECREATE_TEST_DEV is set to true the TEST_DEV device will be
unmounted and FSTYP file system will be created on it. Afterwards it
will be mounted to TEST_DIR again with the default, or specified mount
options.

Also recreate the file system if FSTYP differs from the previous
section.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: Add support for sections in config file
Lukas Czerner [Fri, 4 Apr 2014 06:18:04 +0000 (17:18 +1100)]
check: Add support for sections in config file

This patch add support for sections in the config file. Each section can
contain configuration options in the format

OPTION=value

when one section is processed xfstests will proceed to next section
until all secitons are processed, or an error occur.

The name of the section can consist of alphanumeric characters + '_',
nothing else is allowed. Name of the section is also used to create
results subdirectory for each section. After all the sections are
processed summary of all runs is printed out.

If the config file does not contain sections, or we're not using config
file at all, nothing is changed and xfstests will work the same way as
it used to.

This is very useful for testing file system with different options. Here
is an example of the config file with sections:

[ext4_4k_block_size]
TEST_DEV=/dev/sda
TEST_DIR=/mnt/test
SCRATCH_DEV=/dev/sdb
SCRATCH_MNT=/mnt/test1
MKFS_OPTIONS="-q -F -b4096"
FSTYP=ext4

[ext4_1k_block_size]
MKFS_OPTIONS="-q -F -b1024"

[ext4_nojournal]
MKFS_OPTIONS="-q -F -b4096 -O ^has_journal"

[ext4_discard_ssd]
MKFS_OPTIONS="-q -F -b4096"
TEST_DEV=/dev/sdc
SCRATCH_DEV=/dev/sdd
MOUNT_OPTIONS="-o discard"

Note that once the variable is set it remains set across the sections, so
you do not have to specify all the options in all sections. However one
have to make sure that unwanted options are not set from previous
sections.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: Prepare for config section
Lukas Czerner [Fri, 4 Apr 2014 06:17:53 +0000 (17:17 +1100)]
check: Prepare for config section

This patch only adds the indentation in place so we will be able
to clearly see and review changes made in the second patch which will
add a loop (instead of always-true condition introduced in this patch)
adding support for config sections. There are no changes in the logic,
only indentation changes.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoshared: new test to use up free inodes
Eryu Guan [Fri, 4 Apr 2014 06:17:33 +0000 (17:17 +1100)]
shared: new test to use up free inodes

Test fs by using up all inodes and check fs.

Also a regression test for xfsprogs commit
d586858 xfs_repair: fix sibling pointer tests in verify_dir2_path()

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: add generic test for fallocate zero range
Lukas Czerner [Fri, 4 Apr 2014 06:17:21 +0000 (17:17 +1100)]
generic: add generic test for fallocate zero range

This is based on xfs/242. This is very similar to ext4/001 however this
test has some tweaks to make it work test zero range on generic file
system. This includes turning off ext4 extents zeroout and disabling
the test for xfs on systems where PAGE_SIZE > 4096.

It is testing extent tree manipulation with fallocate zero range
operation.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add test for btrfs send directory moves/renames
Filipe Manana [Fri, 4 Apr 2014 06:17:01 +0000 (17:17 +1100)]
btrfs: add test for btrfs send directory moves/renames

Regression test for a btrfs incremental send issue where the kernel failed
to build paths strings. This resulted either in sending a wrong path string
to the send stream or entering an infinite loop when building it.
This happened in the following scenarios:

1) A directory was made a child of another directory which has a lower inode
   number and has a pending move/rename operation or there's some non-direct
   ancestor directory with a higher inode number that was renamed/moved too.
   This made the incremental send code go into an infinite loop when building
   a path string;

2) A directory was made a child of another directory which has a higher inode
   number, but the new parent wasn't moved nor renamed. Instead some other
   ancestor higher in the hierarchy, with an higher inode number too, was
   moved/renamed too. This made the incremental send code go into an infinite
   loop when building a path string;

3) An orphan directory is created and at least one of its non-immediate
   descendent directories have a pending move/rename operation. This made
   an incremental send issue to the send stream an invalid path string that
   didn't account for the orphan ancestor directory.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add test for btrfs incremental send
Filipe David Borba Manana [Fri, 4 Apr 2014 06:16:41 +0000 (17:16 +1100)]
btrfs: add test for btrfs incremental send

Regression test for a btrfs incremental send issue where invalid paths for
utimes, chown and chmod operations were sent to the send stream, causing
btrfs receive to fail.

If a directory had a move/rename operation delayed, and none of its parent
directories, except for the immediate one, had delayed move/rename operations,
after processing the directory's references, the incremental send code would
issue invalid paths for utimes, chown and chmod operations.

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

    Btrfs: fix send issuing outdated paths for utimes, chown and chmod

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add test for btrfs send issuing premature rmdir operations
Filipe David Borba Manana [Fri, 4 Apr 2014 06:16:23 +0000 (17:16 +1100)]
btrfs: add test for btrfs send issuing premature rmdir operations

Regression test for btrfs incremental send issue where a rmdir instruction
is sent against an orphan directory inode which is not empty yet, causing
btrfs receive to fail when it attempts to remove the directory.

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

    Btrfs: fix send attempting to rmdir non-empty directories

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: add a basic O_TMPFILE test
Christoph Hellwig [Fri, 4 Apr 2014 06:15:56 +0000 (17:15 +1100)]
generic: add a basic O_TMPFILE test

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: add flink support to _require_xfs_io_command
Christoph Hellwig [Fri, 4 Apr 2014 06:15:51 +0000 (17:15 +1100)]
common: add flink support to _require_xfs_io_command

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/300: fix golden output
Eric Sandeen [Thu, 13 Mar 2014 04:20:54 +0000 (15:20 +1100)]
xfs/300: fix golden output

This test was written before a solution was in place, I think,
and so the expected output wasn't well tested.

The test does a loop of sparse writes from 6 to 0, but the
.out file expects 6 (not 7) extents.  Fix it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/280: use waidpid instead of ugly sleep
Dmitry Monakhov [Thu, 13 Mar 2014 04:20:28 +0000 (15:20 +1100)]
generic/280: use waidpid instead of ugly sleep

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoshared/051: add filter to match the golden output for large acls
Jie Liu [Thu, 13 Mar 2014 04:20:18 +0000 (15:20 +1100)]
shared/051: add filter to match the golden output for large acls

On old kernel we return EINVAL if hit the limits of maximum number of
ACLs but return E2BIG on new kernel, which cause the test failes on new
kernel as the output is mismatch to the goldens. This patch fix it by
updating the golden output with the new error message and replacing the
old error message with it via a filter.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add basic functional test for btrfs quota groups
Wang Shilong [Thu, 13 Mar 2014 04:20:09 +0000 (15:20 +1100)]
btrfs: add basic functional test for btrfs quota groups

Add missing test for btrfs quota groups feature,test idea is to create
a parent qgroup that groups some subvolume groups, we try to write
some data into every subvolume and then check if we exceed parent
qgroup's limit size.

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>
8 years agoext4/001: Add ext4 specific test for fallocate zero range
Lukas Czerner [Thu, 13 Mar 2014 04:20:00 +0000 (15:20 +1100)]
ext4/001: Add ext4 specific test for fallocate zero range

This is based on xfs/242. However it's better to make it file system
specific because the range can be zeroes either directly by writing
zeroes, or converting to unwritten extent, so the actual result might
differ from file system to file system. Also xfs results differ
depending on the page size which is not the case for ext4.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofsx: Add fallocate zero range operation
Lukas Czerner [Thu, 13 Mar 2014 04:19:58 +0000 (15:19 +1100)]
fsx: Add fallocate zero range operation

This commit adds fallocate FALLOC_FL_ZERO_RANGE support for fsx.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofsstress: translate flags in fiemap_f
Lukas Czerner [Thu, 13 Mar 2014 04:19:56 +0000 (15:19 +1100)]
fsstress: translate flags in fiemap_f

Translate flags in fiemap_f output to human readable strings.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofsstress: Add fallocate zero range operation
Lukas Czerner [Thu, 13 Mar 2014 04:19:53 +0000 (15:19 +1100)]
fsstress: Add fallocate zero range operation

This commit adds fzero operation support for fsstress, which is meant to
exercise fallocate FALLOC_FL_ZERO_RANGE support.

Also reorganise the common fallocate code into a single do_fallocate()
function and use flags use the right mode.

Also in order to make more obvious which fallocate mode fsstress is
testing translate fallocate flags into human readable strings.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobuild: Move fallocate include into global.h
Lukas Czerner [Thu, 13 Mar 2014 04:19:52 +0000 (15:19 +1100)]
build: Move fallocate include into global.h

Move the inclusion of falloc.h with all it's possible defines for the
fallocate mode into global.h header file so we do not have to include
and define it manually in every tool using fallocate.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/008: Add test for fallocate zero range at block boundary
Lukas Czerner [Thu, 13 Mar 2014 04:19:03 +0000 (15:19 +1100)]
generic/008: Add test for fallocate zero range at block boundary

Add test for fallocate zero range at block boundary. This is similar to
the test xfs/290 however this one is generic and we're testing different
block sizes as well - namely 1k, 2k, 4k and 64k. Note that we're not
creating file systems with given block size buy rather test all 4
options.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: create _test_block_boundaries in common/punch
Lukas Czerner [Thu, 13 Mar 2014 04:18:56 +0000 (15:18 +1100)]
common: create _test_block_boundaries in common/punch

Create new function _test_block_boundaries() which is testing content of
the blocks after the operation such as zero, or punch hole. The test is
doing the operation around block boundaries to assure correct behaviour
of the operation on block unaligned ranges.

This has been based on test xfs/290 which has been changed to use this
new function. A small change to the output file was required.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: Create single function for testing xfs_io commands
Lukas Czerner [Thu, 13 Mar 2014 04:18:56 +0000 (15:18 +1100)]
common: Create single function for testing xfs_io commands

Currently there are several function testing various xfs_io commands.
This commit creates _require_xfs_io_command() to test any xfs_command.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoaio-dio: fix error msg in aio-dio-subblock-eof-read.c
Eric Sandeen [Thu, 13 Mar 2014 04:18:42 +0000 (15:18 +1100)]
aio-dio: fix error msg in aio-dio-subblock-eof-read.c

io_getevents returns the number of events; printing its
return as "bytes read" is ... wrong.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add test for btrfs-progs restore feature
Filipe David Borba Manana [Thu, 13 Mar 2014 04:18:18 +0000 (15:18 +1100)]
btrfs: add test for btrfs-progs restore feature

This is a regression test to verify that the restore feature of btrfs-progs
is able to correctly recover files that have compressed extents, specially when
the respective file extent items have a non-zero data offset field.

This issue is fixed by the following btrfs-progs patch:

    Btrfs-progs: fix restore dealing with compressed extents

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofsstress: add verifiable logging mode
Dmitry Monakhov [Thu, 13 Mar 2014 04:18:01 +0000 (15:18 +1100)]
fsstress: add verifiable logging mode

- It would be useful to have verifiable logging mode which will contain
  only deterministic information which allow to compare two logs files
  generated from two runs with same seed.
- Also add missed help for '-o logfile' option

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: cleanup tests 004, 007, 022 and 025
ZhangZhen [Thu, 13 Mar 2014 04:17:44 +0000 (15:17 +1100)]
btrfs: cleanup tests 004, 007, 022 and 025

As recently suggested by Dave Chinner, make use of the new function
named _run_btrfs_util_prog() to run the btrfs util program.
Filipe David Borba Manana have cleaned up  btrfs/030 and btrfs/034.
I have done the same for the rest ones.

Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add function _require_fssum()
Filipe David Borba Manana [Thu, 13 Mar 2014 04:17:44 +0000 (15:17 +1100)]
btrfs: add function _require_fssum()

To avoid repeating detection of fssum presence in many btrfs tests, as
suggested by Dave Chinner.

Also exported the variable "here" from the main control script, to avoid
repeating its declaration in every single testcase file. Also removed the
declaration of "here" from btrfs test cases that require the fssum program
only. Removing it from all other test cases will be a separate change.

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>
8 years agoxfs/167: need at least 10GB of scratch space to run
Dave Chinner [Thu, 13 Mar 2014 03:58:39 +0000 (14:58 +1100)]
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>
8 years agoxfs/217: prevent enospc failures on small test devices
Dave Chinner [Thu, 13 Mar 2014 03:58:31 +0000 (14:58 +1100)]
xfs/217: prevent enospc failures on small test devices

I'm running xfstests against a ramdisk, so I'm limited in size of
the test and scratch devices. While there are large enough to hold a
filesystem image with a 2GB log, the way the log changes position in
an image file as the size of the filesystem increases means that the
aggregated disk space of xfs/217 is more than enough to run a 4GB
TEST_DEV out of space and hence fail the test.

To avoid this problem, punch out the image file between every mkfs
iteration so that it only consumes the space needed by each
individual mkfs tests, not an aggregation of them all.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/003: ensure time changes between stat calls
Dave Chinner [Thu, 13 Mar 2014 03:58:24 +0000 (14:58 +1100)]
generic/003: ensure time changes between stat calls

On a fast device like a ramdisk, kernel time may not have changed
between a stat of a file and some operation on it immediately
afterwards. Hence there is no guarantee that an operation actually
changes the timestamps of a file immediately after it is stat'd.

Hence, ensure that the times will change by sleeping for a second
between the initial stat that reads the timestamps and the
operations that is supposed to modify them. This way we ensure that
the timestamp will change if the filesystem is correctly
implemented.

While there, fix the indenting to be 8 space tabs and correct the
header which is missing the bash shell declaration and the test
number identifier.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/189: noattr2 invalid for CRC enabled filesystems
Dave Chinner [Thu, 13 Mar 2014 03:58:16 +0000 (14:58 +1100)]
xfs/189: noattr2 invalid for CRC enabled filesystems

Version 5 filesystems always have attr2 format enabled, and it
cannot be turned off via the noattr2 mount option. As such, attempts
to mount with noattr2 will be rejected and this causes cascading
failures within the test.

Hence detect if we've created a CRC enabled filesystem, and if this
is the case _notrun the test.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/033: add golden output for CRC enabled filesystems
Dave Chinner [Thu, 13 Mar 2014 03:58:09 +0000 (14:58 +1100)]
xfs/033: add golden output for CRC enabled filesystems

CRC enabled filesystems emit different errors on corruption.
Specifically, inode corruption is picked up much earlier due to
verifier failures (e.g. incorrect inode identifier) and so
xfs_repair throws errors sufficiently different that filtering
cannot hide the differences. Hence simply add a new golden output
file and link it appropriately once we know what type of filesystem
we are testing.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoshared/005: Test multiple fallocate collapse
Namjae Jeon [Sun, 23 Feb 2014 23:16:24 +0000 (10:16 +1100)]
shared/005: Test multiple fallocate collapse

We execute collapse range multiple times on same file.  Each
collapse range call collapses a single alternate block.  After the
test execution, file will be left with 80 blocks and as much number
of extents.  We also check for file system consistency after the
completion.

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>
8 years agoshared/004: Delayed allocation multi collapse
Namjae Jeon [Sun, 23 Feb 2014 23:11:26 +0000 (10:11 +1100)]
shared/004: Delayed allocation multi collapse

shared/004 tries to test various corner cases with delayed extents
and pre-existing holes for fcollapse range functionality over
different type of extents.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
8 years agoshared/003: Multi collapse range tests
Namjae Jeon [Sun, 23 Feb 2014 23:11:04 +0000 (10:11 +1100)]
shared/003: Multi collapse range tests

shared/003 tries to test various corner cases with pre-existing holes
for fcollapse range functionality over different type of extents.

Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
8 years agoshared/002: Delayed allocation collapse range
Namjae Jeon [Sun, 23 Feb 2014 23:10:20 +0000 (10:10 +1100)]
shared/002: Delayed allocation collapse range

shared/002 tries to test various corner cases with delayed extents
for fcollapse range functionality over different type of extents.

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>
8 years agoshared/001: Standard collapse range tests
Namjae Jeon [Sun, 23 Feb 2014 23:08:16 +0000 (10:08 +1100)]
shared/001: Standard collapse range tests

shared/001 tries to test various corner cases for fcollapse range
functionality over different type of extents.

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>
8 years agogeneric: test for atime-related mount options
Koen De Wit [Tue, 18 Feb 2014 21:26:56 +0000 (08:26 +1100)]
generic: test for atime-related mount options

Tests the noatime, relatime, strictatime and nodiratime mount
options.

There is an extra check for Btrfs to ensure that the access time is
never updated on read-only subvolumes. (Regression test for bug
fixed with commit 93fd63c2f001ca6797c6b15b696a484b165b4800)

Signed-off-by: Koen De Wit <koen.de.wit@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: cleanup tests btrfs/030 and btrfs/034
Filipe David Borba Manana [Tue, 18 Feb 2014 10:18:21 +0000 (21:18 +1100)]
btrfs: cleanup tests btrfs/030 and btrfs/034

As recently suggested by Dave Chinner, make use of the new function
named _run_btrfs_util_prog() to run the btrfs util program, and stop
using run_check for running xfs_io - instead filter xfs_io's output
and add it to the golden output.

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>
8 years agobtrfs: add test for send issuing duplicated rmdir ops
Filipe David Borba Manana [Tue, 18 Feb 2014 10:18:21 +0000 (21:18 +1100)]
btrfs: add test for send issuing duplicated rmdir ops

Regression test for btrfs incremental send issue where an rmdir
instruction was sent multiple times for the same target directory.
The number of times depended on the number of hardlinks against
the same inode inside the target directory. That inode must have
had the highest number of all the inodes that were children of the
directory. This made the btrfs receive command fail immediately once
it received the second rmdir instruction.

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

   Btrfs: send, don't send rmdir for same target multiple times

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>
8 years agobtrfs: add test for incremental send after dir renames
Filipe David Borba Manana [Tue, 18 Feb 2014 10:18:21 +0000 (21:18 +1100)]
btrfs: add test for incremental send after dir renames

Regression test for a btrfs incremental send issue related to
renaming of directories. If at the time of the initial send we have
a directory that is a child of a directory with a higher inode
number, and then later after the initial full send we rename both
the child and parent directories, but without moving any of them, a
subsequent incremental send would produce a rename instruction for
the child directory that pointed to an invalid path.  This made the
btrfs receive operation fail.

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

   Btrfs: incremental send, fix invalid path after dir rename

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>
8 years agobtrfs: add regression test for incremental send
Filipe David Borba Manana [Tue, 18 Feb 2014 10:18:20 +0000 (21:18 +1100)]
btrfs: add regression test for incremental send

Test for a btrfs incremental send issue where we end up sending a
wrong section of data from a file extent if the corresponding file
extent is compressed and the respective file extent item has a non
zero data offset.

Fixed by the following linux kernel btrfs patch:

   Btrfs: use right clone root offset for compressed extents

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>
8 years agobtrfs/005: log test result to right path
Wang Shilong [Tue, 18 Feb 2014 10:18:20 +0000 (21:18 +1100)]
btrfs/005: log test result to right path

We should log test results to $seqres.full not $seq.full.

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>
8 years agoxfs: ensure bad primary sb crc fails mount
Eric Sandeen [Tue, 18 Feb 2014 10:18:20 +0000 (21:18 +1100)]
xfs: ensure bad primary sb crc fails mount

the commit:
10e6e65 xfs: be more forgiving of a v4 secondary sb w/ junk in v5 fields
broke primary sb CRC validation, not erroring out the mount
if the crc was bad.

This tests that it's fixed, and properly fails the mount on
a bad crc.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs: check that junk in V4 superblocks doesn't break growfs
Eric Sandeen [Tue, 18 Feb 2014 10:18:18 +0000 (21:18 +1100)]
xfs: check that junk in V4 superblocks doesn't break growfs

Test that we properly ignore old growfs-induced junk in the unused
portion of secondary V4 superblocks; at one point this would
trip up the verifiers, and cause a subsequent growfs to fail.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs/004: fix to make test really work
Wang Shilong [Tue, 18 Feb 2014 10:18:16 +0000 (21:18 +1100)]
btrfs/004: fix to make test really work

So I was wondering why test 004 could pass my previous wrong
kernel patch while it defenitely should not.

By some debugging, i found here perl script is wrong, we did not
filter out anything and this unit test did not work acutally.so
it came out we will never fail this test.

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>
8 years agoxfs: test setting XFS BMBT fields in xfs_db
Mark Tinguely [Tue, 18 Feb 2014 10:18:16 +0000 (21:18 +1100)]
xfs: test setting XFS BMBT fields in xfs_db

Test the setting of the XFS BMBT fields via xfs_db. Runs through the
valid bit values for each field and tests an illegal value.

[dchinner: added _require_xfs_mkfs_crc and turned off crcs so that
the test doesn't just fail on CRC enabled test runs.]

[dchinner: added hex block values to check they don't get endian
swapped.]

Signed-off-by: Mark Tinguely <tinguely@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add test for data corruption when using compression
Filipe David Borba Manana [Tue, 18 Feb 2014 07:04:00 +0000 (18:04 +1100)]
btrfs: add test for data corruption when using compression

Test for a btrfs data corruption when using compressed
files/extents.  Under certain cases, it was possible for reads to
return random data (content from a previously used page) instead of
zeroes. This also caused partial updates to those regions that were
supposed to be filled with zeroes to save random (and invalid) data
into the file extents.

This is fixed by the commit for the linux kernel titled:

   Btrfs: fix data corruption when reading/updating compressed extents
   (https://patchwork.kernel.org/patch/3610391/)

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add a regression test for running snapshot and send concurrently
Wang Shilong [Tue, 18 Feb 2014 06:50:23 +0000 (17:50 +1100)]
btrfs: add a regression test for running snapshot and send concurrently

Btrfs would fail to send if snapshot run concurrently, this test is to make
sure we have fixed the bug.

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>
8 years agobtrfs: add new clone overwrite regression test
David Disseldorp [Tue, 18 Feb 2014 06:19:34 +0000 (17:19 +1100)]
btrfs: add new clone overwrite regression test

This test uses the newly added cloner binary to dispatch full file and
range specific clone (reflink) requests.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agosrc/cloner: use btrfs/ioctl.h header if present
David Disseldorp [Tue, 18 Feb 2014 06:18:42 +0000 (17:18 +1100)]
src/cloner: use btrfs/ioctl.h header if present

Check for the btrfsprogs-devel ioctl.h header at configure time. Use it
in src/cloner if present, otherwise fall back to using the copied clone
ioctl definitions.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add small program for clone testing
David Disseldorp [Tue, 18 Feb 2014 06:18:15 +0000 (17:18 +1100)]
btrfs: add small program for clone testing

The cloner program is capable of cloning files using the BTRFS_IOC_CLONE
and BTRFS_IOC_CLONE_RANGE ioctls.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/021: filter v5 filesystem metadata
Dave Chinner [Tue, 18 Feb 2014 06:16:34 +0000 (17:16 +1100)]
xfs/021: filter v5 filesystem metadata

The xfs_db output is different for v5 filesystem metadata, and so
the test fails due to golden image mismatches rather than an actual
test failure. Improve the filter to hide the differences between the
metadata format outputs.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/299: users can't modify root owned files
Dave Chinner [Tue, 18 Feb 2014 06:16:26 +0000 (17:16 +1100)]
xfs/299: users can't modify root owned files

xfs/299 has failed for me for a long time. In fact, looking at my
logs it has never passed on any of my test machines. IOWs, the
test that was committed was fundamentally broken.

The reason is that it tests project quotas before it tests user or
group quotas and so creates a bunch of files that are owned by root
or privileged users. It think tries to manipulate them as a user,
and, unsurprisingly, it fails to do so. This then causes the test to
throw an error.

The reason it has always failed is the error that is thrown
hardcodes a uid/gid into an error message. This uid/gid is what
causes the golden output mismatch (nobody is 65534 on my machines,
not 99):

     *** push past the hard block limit (expect EDQUOT)
     [ROOT] 0 0 0 00 [--------] 12 0 0 00 [--------] 0 0 0 00 [--------]
     [NAME] =OK= 100 500 00 [--------] 7 4 10 00 [7 days] 0 0 0 00 [--------]
    - URK 99: 0 is out of range! [425,500]
    + URK 65534: 0 is out of range! [425,500]

It wasn't until I looked at the xfs/299.full file when trying to
understand why the error was being thrown and whether it shoul dhave
been in the golden output in the first place that I saw the real
problem. That is, All the user/group quota modifications were
failing because of not having permissions to write the files left
behind by the quota test, and that user and group quotas were not
being tested at all by the test.

So, firstly $SCRATCH_MNT needs to be world writeable, and secondly
each test needs to remove the files it created during the test so
they don't impact on furture test iterations.

This then exercises the user and group quotas appropriately, and so
the golden output changes completely to reflect that changes under
user quotas are actually being accounted to the correct user.
Further, the error message that I originally saw errors on goes
away, because everything is now accounted correctly.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/008: initialize "valid" bitmap in randholes.c
Eric Sandeen [Thu, 6 Feb 2014 05:43:17 +0000 (16:43 +1100)]
xfs/008: initialize "valid" bitmap in randholes.c

Failures were reported in xfs/008 on s390; dchinner suggested that
perhaps the uninitialized "valid" bitmap was behaving differently on
that platform, and sure enough, this patch fixes things up.

TBH, I'm not sure why using an uninitialized bitmap worked at
all, ever, anywhere...?

[ dchinner explains during review:

It depends on glibc behaviour to whether newly allocated memory is
zeroed or not. e.g. for large allocations glibc uses
mmap() to directly map anonymous pages for the allocation. These get
zeroed by the kernel before being mapped into the user address
space. If glibc allocates from the heap and needs to grow it, it
uses sbrk() to grow the heap and those pages are, again, zeroed by
the kernel. However, if the allocation comes from the heap from
previously freed memory, then it doesn't get zeroed.

I'd say that the 3rd case is occurring here - there's memory that is
allocated and freed as part of the program startup that the bitmap
is being allocated from, and so it's not newly zeroed pages that it
is being allocated from... ]

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/066: stat the test file, not the directory
Dave Chinner [Thu, 6 Feb 2014 05:36:17 +0000 (16:36 +1100)]
xfs/066: stat the test file, not the directory

Ever since commit 7e2a19504 ("ls -l reports different file size
depending on platform and user.") xfs/066 has been running stat on
the dump/restore directory instead of the large file that the test
is checking can be dumped and restored correctly. IOWs, it's not
been checking the correct thing for almost 10 years.

This test fails on CRC enabled filesystems because the shortform
directory entry size is different (an extra byte for the filetype
filed), and this is where tracking down the failure has lead me.

Fix this by using the correct target file, and improve it by dumping
an md5sum of the source and target files to ensure they contain the
same data.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/296: fix golden output
Dave Chinner [Thu, 6 Feb 2014 05:36:14 +0000 (16:36 +1100)]
xfs/296: fix golden output

This test never passed, so the golden output was never properly
verified as correct. Now that the bug is fixed, fix the golden
output to match the actual test output.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: inconsistent initial state for test_generic_punch
Dave Chinner [Tue, 4 Feb 2014 00:52:37 +0000 (11:52 +1100)]
generic: inconsistent initial state for test_generic_punch

The first test may start with the file from the previous test, and
that is in an unknown state. Hence always remove the test file
before the first test so that it doesn't have extents inside the
test range as it is supposed to be testing into a hole.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: _test_generic_punch not blocksize clean
Dave Chinner [Tue, 4 Feb 2014 00:52:26 +0000 (11:52 +1100)]
generic: _test_generic_punch not blocksize clean

Test 17 of _test_generic_punch uses the filesystem block size to do
a sub-single block punch. The result of this is a files of
different sizes and md5sums when the filesystem block size changes.
However the only difference in file contents if the length of the
file - the zeroed region is always in the same place. Hence we can
use hexdump rather than md5sum to check the output remains
consistent and the hole remains in the correct place despite the
changing block sizes.

Fix up all the golden output for all the tests that use this
function, too.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/291: fix spurious ENOSPC errors
Dave Chinner [Tue, 4 Feb 2014 00:52:17 +0000 (11:52 +1100)]
xfs/291: fix spurious ENOSPC errors

xfs/291 tries to fill the filesystem almost full, so if the log size
changes with mkfs defaults then it's free space calculations are not
longer valid and so it throws lots of ENOSPC errors during a run.
This is not fatal for this test, but it does increase the runtime of
it and fill the 291.full file with unnecessary errors.

The number of frag files it creates is also too many for a 512 byte
inode filesystem (by about 900) so reduce the number of inodes
initially created so the test works ofr 512 byte inodes. With 512
byte inodes, the free space histogram looks like this after the frag
phase:

   from      to extents  blocks    pct
      1       1   10730   10730 100.00

And for 256 byte inodes:

   from      to extents  blocks    pct
      1       1   12388   12388 100.00

So these changes do not affect the intended operation of the test.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/199: enforce v4 superblock format for test
Dave Chinner [Tue, 4 Feb 2014 00:52:03 +0000 (11:52 +1100)]
xfs/199: enforce v4 superblock format for test

This test relies of the contents of the sb_features2 field being
known. Make sure ot clear allt eh MKFS_OPTIONS and ensure that we
direct mkfs to create only the simplest of featuresets to test this
functionality.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfstests: add test for btrfs incremental send data corruption
Filipe David Borba Manana [Tue, 4 Feb 2014 00:51:08 +0000 (11:51 +1100)]
xfstests: add test for btrfs incremental send data corruption

Btrfs incremental send had an issue where it would detect a non-existent
file hole and then overwrite the file section that hole covers with zeroes,
overriding file data that it shouldn't.

The respective btrfs kernel patch that fixed this issue is titled:

   Btrfs: fix send file hole detection leading to data corruption
   (https://patchwork.kernel.org/patch/3544831/)

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs/030: add more test cases
Filipe David Borba Manana [Sun, 2 Feb 2014 23:06:50 +0000 (10:06 +1100)]
btrfs/030: add more test cases

This change adds some new tests for btrfs' incremental send feature.
These are all related with inverting the parent-child relationship
of directories, and cover the cases:

* when the new parent didn't get renamed (just moved)
* when a child file of the former parent gets renamed too

These new cases are fixed by the following btrfs linux kernel patches:

* "Btrfs: more send support for parent/child dir relationship inversion"
* "Btrfs: fix send dealing with file renames and directory moves"

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>
8 years agoext4/306: avoid failures caused by incompatible mount options
Eric Whitney [Sun, 2 Feb 2014 23:06:50 +0000 (10:06 +1100)]
ext4/306: avoid failures caused by incompatible mount options

ext4/306 will fail when mounting the ext3 file system it creates if an
ext3-incompatible mount option is applied by _scratch_mount.  This can
happen if EXT_MOUNT_OPTIONS is defined appropriately in the test
environment.  For example, the block_validity option is commonly used
to enhance ext4 testing, and it is not supported by ext3.

Fix this by instead creating an ext4 file system without extents as a
functionally equivalent substitute.  This will also eliminate a
dependency for ext3 support on the test system.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/299: truncate can fail with ENOSPC
Josef Bacik [Sun, 2 Feb 2014 23:06:50 +0000 (10:06 +1100)]
generic/299: truncate can fail with ENOSPC

So this test does lots of fallocate/truncate noise while doing aio
overwrites to try and exercise a deadlock found in ext4.  Because it
runs so hard with ENOSPC it can sometimes cause truncate to fail on
btrfs.  This is ok and doesn't affect the validity of the test, we
just need to catch the output so it doesn't cause the test to fail.
Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/313: initialise TEST_DIR before use
Brian Foster [Sun, 2 Feb 2014 23:06:42 +0000 (10:06 +1100)]
generic/313: initialise TEST_DIR before use

The 'testfile' environment variable is initialized before the
xfstests environment is included into generic/313. TEST_DIR is not
defined at this point and causes the test to operate on the root.
Move the testfile initialization down after the general environment
is sourced.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs/029: filter mkfs and cp output
Josef Bacik [Sun, 2 Feb 2014 23:06:41 +0000 (10:06 +1100)]
btrfs/029: filter mkfs and cp output

I noticed while testing a different mkfs option that btrfs/029 was
failing because it was getting the extra output from our mkfs.btrfs.
After I fixed that I was still failing because my version of cp will
spit out the source and destination files, not just the destination
file.  So redirect _scratch_mkfs to /dev/null like everybody does
and make the golden output just expect to see "cp failed" instead of
the cp specific output.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs: remove spurious line continuation from _require_xfs_crc
Brian Foster [Sun, 2 Feb 2014 23:06:23 +0000 (10:06 +1100)]
xfs: remove spurious line continuation from _require_xfs_crc

This causes the mkfs to fail and leads to tests being skipped.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs/025: make test more robust
Filipe David Borba Manana [Sun, 2 Feb 2014 23:06:14 +0000 (10:06 +1100)]
btrfs/025: make test more robust

Make the test btrfs/025 not depend on the output of the btrfs tools
subvolume, send, receive and filesystem commands output. The output
of these commands has changed several times in the past, and it can
change again in the future. Therefore just test for failure/success
and not for the exact output on the success case.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoBtrfs: add regression test for iterating backrefs
Wang Shilong [Sun, 2 Feb 2014 23:05:34 +0000 (10:05 +1100)]
Btrfs: add regression test for iterating backrefs

Btrfs send/scrub/defrag/qgroup need to walk backrefs,this test
is to make sure iterating backrefs with ulist is working and don't
cause a kernel panic here.

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>
8 years agoBtrfs: add regression test for transaction abortion when remounting
Wang Shilong [Sun, 2 Feb 2014 22:50:41 +0000 (09:50 +1100)]
Btrfs: add regression test for transaction abortion when remounting

Btrfs would get a transaction abortion when remounting RW to RO with
flushoncommit enabled. This test is to check if bug still exists.

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>
8 years agoxfstests: define $seqres in btrfs/026-029
Koen De Wit [Fri, 24 Jan 2014 01:06:45 +0000 (12:06 +1100)]
xfstests: define $seqres in btrfs/026-029

I forgot to define $seqres in btrfs/026-029. As a result, a file named
.full was created in the current working directory. Fix it.

Signed-off-by: Koen De Wit <koen.de.wit@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>