Qu Wenruo [Mon, 21 Sep 2015 03:06:18 +0000 (13:06 +1000)]
new: Add seqres.full cleanup to template
Add cleanup for seqres.full for new test case template, as sometimes
new testcase may forgot to cleanup seqres.full.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Jan Kara [Mon, 21 Sep 2015 03:06:18 +0000 (13:06 +1000)]
fstests: Add test of rename
Test renaming of various entry types in directories of various sizes.
Check that filesystem didn't get corrupted.
[dchinner: fixed missing bits from new test template, removed
checking of scratch as harness does that. ]
Signed-off-by: Jan Kara <jack@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eric Sandeen [Mon, 21 Sep 2015 03:06:18 +0000 (13:06 +1000)]
xfs/077: fix test for userspace meta_uuid support
The current _require_meta_uuid() test looks for a failure return
code from xfs_db -x -c "uuid generate" but in fact this exits
with success. (In fact uuid_f always exits with success; perhaps
this needs fixing, but that's in the wild now).
So grep for the string(s) stating that it failed, instead.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Mon, 21 Sep 2015 03:06:17 +0000 (13:06 +1000)]
ext4/305: reduce runtime by limiting mount/umount cycles
ext4/305 sleeps 3 minutes and does mount/umount loop in background,
which produces lots of logs in dmesg and 3 minutes is not necessary.
Ted pointed out that 30 mount/umount cycles is enough to crash a buggy
kernel, so just limit the mount/umount loop to reduce the runtime. And
now the runtime is about 2s.
Reported-by: Theodore Ts'o <tytso@mit.edu>
Suggested-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Zhao Lei [Mon, 21 Sep 2015 03:06:17 +0000 (13:06 +1000)]
_filter_uuid: Fix output regression for btrfs/006
_filter_uuid() get updated and changed output from:
uuid: <UUID>
->
uuid: <UUID>
It is a typo introduced by xfs/077, this patch fixed this.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Mon, 21 Sep 2015 03:06:17 +0000 (13:06 +1000)]
btrfs: fsync after extent cloning
Test that if we fsync a file that got one extent partially cloned into a
lower file offset, after a power failure our file has the same content it
had before the power failure and after the extent cloning operation.
This test is motivated by an issue found in btrfs that is fixed by the
linux kernel patch titled:
"Btrfs: fix file read corruption after extent cloning and fsync"
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Zorro Lang [Mon, 21 Sep 2015 03:06:17 +0000 (13:06 +1000)]
xfs/194: fix the exception when run on 4k sector drives
The below command in "Test 4":
xfs_io -c "pwrite -S 0x33 -b 512 `expr $blksize \* 2` 512"
will run failed on 4k sector drives. So I use sector size to
replace the hard-code 512.
And we won't run this case when $sector_size > $page_size / 8.
Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Zorro Lang [Mon, 21 Sep 2015 03:06:17 +0000 (13:06 +1000)]
xfs/201: use min_dio_alignment size to replace 512b
This case use hard-code 512, but in 4k sector size device,
it will fail.
So I call _min_dio_alignment() to get the sector size, then
replace `512`.
Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Zorro Lang [Mon, 21 Sep 2015 03:06:17 +0000 (13:06 +1000)]
xfs: use -f option for xfs_repair a fs image
xfs/020 need -f option, or it'll be fail on 4k sector device.
Add -f option for xfs/032 for safe and better.
There're some cases use _check_xfs_filesystem(), or others
function which call this function to check a regular file.
That's will fail when the regular file on a 4k sector device.
For example xfs/250.
So I change _check_xfs_filesystem(), add -f option to xfs_repair,
when the $device is a file.
Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Zorro Lang [Mon, 21 Sep 2015 03:06:15 +0000 (13:06 +1000)]
generic/084: use src/multi_open_unlink to replace tail command
generic/084 try to run 'tail' command, tail will use inotify.
There're some limit about the number of inotify. For example
fs.inotify.max_user_instances specifies an upper limit on
the number of inotify instances that can be created per real
user ID.
When I test on a machine with 154 cpu cores, this case run
failed, and hit many warning likes:
+tail: inotify cannot be used, reverting to polling: Too many open files
Because the fs.inotify.max_user_instances is 128, so if we
try to tail 154 files, it will be failed.
So use src/multi_open_unlink to instead of tail will avoid
this problem.
Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Darrick J. Wong [Mon, 21 Sep 2015 03:06:11 +0000 (13:06 +1000)]
xfs: test file/symlink metadata corruption checking and repair
Targeted fuzzing tests which destroy various pieces of file and
symlink metadata; the tests look for (a) kernel detection of
corruption, (b) xfs_repair repair of said corruption, and (c)
post-repair fs usability.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Darrick J. Wong [Mon, 21 Sep 2015 02:50:36 +0000 (12:50 +1000)]
xfs: test directory metadata corruption checking and repair
Targeted fuzzing tests which destroy various pieces of directory
metadata; the tests look for (a) kernel detection of corruption, (b)
xfs_repair repair of said corruption, and (c) post-repair fs
usability.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Darrick J. Wong [Mon, 21 Sep 2015 02:50:22 +0000 (12:50 +1000)]
xfs: test allocation group metadata corruption checking and repair
Targeted fuzzing tests which destroy various pieces of filesystem or
allocation group metadata; the tests look for (a) kernel detection of
corruption, (b) xfs_repair repair of said corruption, and (c)
post-repair fs usability.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Darrick J. Wong [Mon, 21 Sep 2015 02:13:50 +0000 (12:13 +1000)]
ext4: test file/dir/symlink metadata corruption checking and repair
Targeted fuzzing tests which destroy various pieces of file,
directory, and symlink metadata; the tests look for (a) kernel
detection of corruption, (b) e2fsck repair of said corruption, and (c)
post-repair fs usability.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Darrick J. Wong [Mon, 21 Sep 2015 02:09:16 +0000 (12:09 +1000)]
ext4: test block group metadata corruption checking and repair
Targeted fuzzing tests which destroy various pieces of filesystem or
block group metadata; the tests look for (a) kernel detection of
corruption, (b) e2fsck repair of said corruption, and (c) post-repair
fs usability.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Darrick J. Wong [Mon, 21 Sep 2015 02:03:39 +0000 (12:03 +1000)]
fuzz: randomly fuzz XFS and ext4 filesystems
Introduce tests for XFS and ext4 which format a filesystem, populate
it, then uses blocktrash and e2fuzz to corrupt the metadata. The FS
is remounted, modified, and unmounted. Following that, xfs_repair or
e2fsck are run until it no longer finds errors to correct, after which
the FS is mounted yet again and exercised to see if there are any
errors remaining.
The XFS test requires an xfs_db that can handle blocktrash and v5
filesystems.
The ext4 test requires metadata_csum support in e2fsprogs.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Darrick J. Wong [Mon, 21 Sep 2015 01:06:24 +0000 (11:06 +1000)]
common: add routines to fuzz filesystems
Create common/populate with routines to support the new fuzz tests.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Mon, 21 Sep 2015 01:05:44 +0000 (11:05 +1000)]
xfs/074: specify filesystem size in terms of size not block count
When testing 512 block size xfs, xfs/074 fails as
QA output created by 074
+fallocate: No space left on device
Silence is golden
That's because
40051712*512=20G < 30G.
And quote from Dave:
That was sized to give AGs of a specific size, which originally
contributed to the problem being exposed. You should change the block
count specification to a size specification so the filesysetm being
made on 4k block size filesystems remains unchanged.
size =
40051712b
=
40051712 * 4096
= 164,051,812,352
= 156452m
So set the filesystem size to 156452m explicitly.
Suggested-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eric Whitney [Mon, 21 Sep 2015 01:05:26 +0000 (11:05 +1000)]
generic/064: allow room for unexpected allocation behavior
Per Dave Chinner's suggestion, modify generic/064 so that it won't fail
if it finds a few more extents than it expects in its test file after
inserting ranges. When 064's test file is first created, some file
systems may use more than the ideal minimum single extent to represent
it, and this can lead to a mismatch between the actual and expected
extent count after the ranges have been inserted. Ext4 file systems
mounted with delayed allocation disabled can exhibit this behavior
if a test file's blocks happen to be allocated across regions of file
system metadata.
Also, replace the open coded counting of extents and holes with a
simpler call to _count_extents(), and clarify some comments.
Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Dave Chinner [Mon, 21 Sep 2015 01:04:59 +0000 (11:04 +1000)]
xfs/042: reduce runtime of the test
xfs/042 is really an xfs_fsr test, and it only writes about 60MB of
data. however, because it is trying to write lots of data in ENOSPC
conditions, it can take a long time as XFS does flushes to maximise
space usage at ENOSPC. e.g. on a slow 1p VM:
xfs/042 426s ... 425s
It takes a long time to write a small amount of data. To avoid this
slow flushing problem, create the fragmented files with fallocate()
rather than write(), which fails much faster as there is no dirty
data to flush before retrying the allocation and failing. THis
results in:
xfs/042 425s ... 11s
A massive reduction in runtime, such that we can consider putting
xfs/042 into the quick group....
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Mon, 21 Sep 2015 01:04:25 +0000 (11:04 +1000)]
generic: fsync files with multiple links
Test that when we have a file with multiple hard links belonging to
different parent directories, if we remove one of those links, fsync the
file using one of its other links (that has a parent directory different
from the one we removed a link from), power fail and then replay the
fsync log/journal, the hard link we removed is not available anymore and
all the filesystem metadata is in a consistent state.
This test is motivated by an issue found in btrfs, where the test fails
with:
generic/107 2s ... - output mismatch (see .../results/generic/107.out.bad)
--- tests/generic/107.out 2015-08-04 09:47:46.
922131256 +0100
+++ /home/fdmanana/git/hub/xfstests/results//generic/107.out.bad
@@ -1,3 +1,5 @@
QA output created by 107
Entries in testdir:
foo2
+foo3
+rmdir: failed to remove '/home/fdmanana/btrfs-tests/scratch_1/testdir': Directory not empty
...
(Run 'diff -u tests/generic/107.out .../generic/107.out.bad' to see the entire diff)
_check_btrfs_filesystem: filesystem on /dev/sdc is inconsistent (see .../generic/107.full)
_check_dmesg: something found in dmesg (see .../generic/107.dmesg)
$ cat /home/fdmanana/git/hub/xfstests/results//generic/107.full
_check_btrfs_filesystem: filesystem on /dev/sdc is inconsistent
*** fsck.btrfs output ***
checking extents
checking free space cache
checking fs roots
root 5 inode 257 errors 200, dir isize wrong
unresolved ref dir 257 index 3 namelen 4 name foo3 filetype 1 \
errors 5, no dir item, no inode ref
$ cat /home/fdmanana/git/hub/xfstests/results//generic/107.dmesg
(...)
[188897.707311] BTRFS info (device dm-0): failed to delete reference to \
foo3, inode 258 parent 257
[188897.711345] ------------[ cut here ]------------
[188897.713369] WARNING: CPU: 10 PID: 19452 at fs/btrfs/inode.c:3956 \
__btrfs_unlink_inode+0x182/0x35a [btrfs]()
[188897.717661] BTRFS: Transaction aborted (error -2)
(...)
[188897.747898] Call Trace:
[188897.748519] [<
ffffffff8145f077>] dump_stack+0x4f/0x7b
[188897.749602] [<
ffffffff81095de5>] ? console_unlock+0x356/0x3a2
[188897.750682] [<
ffffffff8104b3b0>] warn_slowpath_common+0xa1/0xbb
[188897.751936] [<
ffffffffa04c5d09>] ? __btrfs_unlink_inode+0x182/0x35a [btrfs]
[188897.753485] [<
ffffffff8104b410>] warn_slowpath_fmt+0x46/0x48
[188897.754781] [<
ffffffffa04c5d09>] __btrfs_unlink_inode+0x182/0x35a [btrfs]
[188897.756295] [<
ffffffffa04c6e8f>] btrfs_unlink_inode+0x1e/0x40 [btrfs]
[188897.757692] [<
ffffffffa04c6f11>] btrfs_unlink+0x60/0x9b [btrfs]
[188897.758978] [<
ffffffff8116fb48>] vfs_unlink+0x9c/0xed
[188897.760151] [<
ffffffff81173481>] do_unlinkat+0x12b/0x1fb
[188897.761354] [<
ffffffff81253855>] ? lockdep_sys_exit_thunk+0x12/0x14
[188897.762692] [<
ffffffff81174056>] SyS_unlinkat+0x29/0x2b
[188897.763741] [<
ffffffff81465197>] system_call_fastpath+0x12/0x6f
[188897.764894] ---[ end trace
bbfddacb7aaada8c ]---
[188897.765801] BTRFS warning (device dm-0): __btrfs_unlink_inode:3956: \
Aborting unused transaction(No such entry).
Tested against ext3/4, xfs, reiserfs and f2fs too, and all these
filesystems currently pass this test (on a 4.1 linux kernel at least).
The btrfs issue is fixed by the linux kernel patch titled:
"Btrfs: fix stale dir entries after removing a link and fsync".
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Dave Chinner [Mon, 21 Sep 2015 01:03:22 +0000 (11:03 +1000)]
generic/038: speed up file creation
Now that generic/038 is running on my test machine, I notice how
slow it is:
generic/038 692s
11-12 minutes for a single test is way too long.
The test is creating
400,000 single block files, which can be easily parallelised and
hence run much faster than the test is currently doing.
Split the file creation up into 4 threads that create 100,000 files
each. 4 is chosen because XFS defaults to 4AGs, ext4 still has decent
speedups at 4 concurrent creates, and other filesystems aren't hurt
by excessive concurrency. The result:
generic/038 237s
on the same machine, which is roughly 3x faster and so it (just)
fast enough to to be considered acceptible.
[Eryu Guan: reduced number of files to minimum needed to reproduce
btrfs problem reliably, added $LOAD_FACTOR scaling for longer
running.]
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Mon, 21 Sep 2015 01:02:46 +0000 (11:02 +1000)]
ext4/005: add missing out file back
ext4/005.out is missing, add it back.
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Dave Chinner [Tue, 4 Aug 2015 06:34:42 +0000 (16:34 +1000)]
xfstests: fix build errors and warnings
After upgrading userspace on test machines to xfsprogs-4.2.0-rc1,
lots of build warnings and failures are exposed from implicit
includes that no longer exist. Hence these need fixing to allow
fstests to build correctly.
gcc also seems to have grown new stupidities around uninitialised
variables, so fix them while touching the same files.
Signed-off-by: Dave Chinner <david@fromorbit.com>
Dongsheng Yang [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
generic/038: mount scratch before checking it
We want to check the size of scratch with _require_fs_space,
but we have to mount it firstly.
Reported-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
btrfs: test for incremental send after file extent cloning
Test that an incremental send works after a file gets one of its extents
cloned/deduplicated into lower file offsets.
This is a regression test for the problem fixed by the linux kernel patch
titled:
"Btrfs: teach backref walking about backrefs with underflowed
offset values"
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
common: fix _count_extents and _count_holes
In _count_extents and _count_holes, the output of 'xfs_io -c "fiemap"'
is saved in var res, but the following "echo $res" will merge the
original output into one line. e.g.
0: [0..63]: 96..159
1: [64..127]: hole
will be
0: [0..63]: 96..159 1: [64..127]: hole
so the extent count is always 0 if there's a hole.
This makes generic/046 fail occasionally. (Seems it's easier to
reproduce when the system is under some presure, e.g. with fsstress
running.)
Tested the new _count_extents and _count_holes with generic/04[3-9] and
tests all passed as expect.
Reported-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Theodore Ts'o [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
locktest: remove manual declaration of errno
locktest.c has already #included <errno.h>, so remove the unneeded
(and in some cases, incorrect) manual declaration of errno as an
integer. Some C libraries use a macro to provide thread-safety for
errno, so it's incorrect to try to provide a manual declaration.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Theodore Ts'o [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
lstat64:: use Posix st_mode defines
Instead of the obsolete SysV S_IEXEC, S_IREAD, and S_IWRITE, use
the Posix defines of S_I[WRX]{OTH,GRP,USR}.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Kamalesh Babulal [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
check: Fix a typo
Fix the spelling of 'Argments' -> 'Arguments'.
Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
generic: file fsync after unlink and inode eviction
Test that if we remove one hard link from an inode, evict the inode,
fsync the inode, power fail and then mount the filesystem, the hard
link we removed does not exists anymore and the filesystem metadata
is in a consistent state.
This test is motivated by an issue found on btrfs, and on an unpatched
btrfs it fails with:
FSTYP -- btrfs
PLATFORM -- Linux/x86_64 debian3 4.1.0-rc6-btrfs-next-11+
MKFS_OPTIONS -- /dev/sdc
MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1
generic/098 4s ... - output mismatch (see .../generic/098.out.bad)
--- tests/generic/098.out 2015-07-23 18:01:12.
616175932 +0100
+++ .../generic/098.out.bad 2015-07-23 18:04:58.
924138308 +0100
@@ -1,3 +1,6 @@
QA output created by 098
Entries in testdir:
+bar
foo
+rm: cannot remove '.../testdir/foo': Stale file handle
+rmdir: failed to remove '.../scratch_1/testdir': Directory not empty
...
_check_btrfs_filesystem: filesystem on /dev/sdc is inconsistent ...
(...)
$ cat /home/fdmanana/git/hub/xfstests/results/generic/098.full
(...)
checking fs roots
root 5 inode 258 errors 2001, no inode item, link count wrong
unresolved ref dir 257 index 0 namelen 3 name foo filetype 1 errors 6,\
no dir index, no inode ref
unresolved ref dir 257 index 3 namelen 3 name bar filetype 1 errors 5,\
no dir item, no inode ref
(...)
Tested against ext3/4, xfs, f2fs and reiserfs.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Omar Sandoval [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
btrfs/011: test replace on RAID 5/6 now that it's supported
btrfs replace has been supported on RAID 5/6 since Linux 3.19.
Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Jan Tulak [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
check: add a flag for direct printing of test output
Add -d debug dump flag to ./check to directly print a test output
to stdout, instead of just saving it into a file and showing a diff
snippet.
Useful e.g. when writing a new test.
Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Jan Tulak [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
check: Allow partial test names
When running ./check and calling a test with a name, id is enough
to find the test (names added in
03c633bf).
If the full test path is tests/xfs/123-foo-bar, then all these
invocations should work, as long as the given part of the test name
is valid and the three-digits id is here.
./check xfs/123-foo-bar
./check xfs/123-foo
./check xfs/123
Always use full test name in results.
Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
xfs/078: omit -m crc=0 mkfs option if mkfs.xfs has no meta support
This basically does the same as in commit
90a3bfc xfs: be compatible with older mkfs.xfs which has no v5 support
which left xfs/078 behind.
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Zhao Lei [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
check: Make -g and -x option meet description in manual
In manual:
# ./check --help
...
-g group[,group...] include tests from these groups
-x group[,group...] exclude tests from these groups
...
Above format is not supported, because ',' is not parsed in code.
This patch fixed it.
Before patch:
# ./check -g scrub,replace
Group "scrub,replace" is empty or not defined?
After patch:
# ./check -g scrub,replace
FSTYP -- btrfs
PLATFORM -- Linux/x86_64 kerneldev 4.2.0-rc2_HEAD_c65b99f046843d2455aa231747b5a07a999a9f3d_+
MKFS_OPTIONS -- /dev/vdd
MOUNT_OPTIONS -- /dev/vdd /var/ltf/tester/scratch_mnt
...(right result)...
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Brian Foster [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
xfs: test log recovery checksum with different log buf sizes
XFS had a bug which lead to spurious checksum failures during
verification of log records during recovery. This occurred when the
filesystem was mounted for recovery with a different log buffer size
(via the 'logbsize=...' mount option from when the filesystem crashed.
Create a regression test that dirties the log using one particular log
buffer size, shuts down the fs and attempts recovery using a larger log
buffer size.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eric Sandeen [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
PATCH 3/3 V6] xfs: test changing UUID on V5 superblock
Tests xfs_db's ability to change & restore UUIDs on V5 filesystems,
and tests xfs_copy's ability to change the UUID on the copy.
Update to _filter_uuid is so that it will catch the UUID output
from xfs_admin -u, which is slightly different than the regexp it
was expecting.
This requires new userspace which knows how to change the UUID on
a V5 superblock.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
generic: test for fsync after adding hard links
Test that if we add hard links (in the same directory) to two files and
then fsync only one of the files, after the fsync log/journal is replayed
all the links exist and the filesystem metadata (directory and file
inodes) is in a consistent state.
This test is motivated by a bug found in btrfs that is fixed by linux
kernel patch titled:
"Btrfs: fix stale directory entries after fsync log replay"
Verified against ext3/4, xfs, f2fs and reiserfs on a 4.1 linux kernel.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
btrfs: regression test for the clone ioctl
This tests that we can not clone an inline extent into a non-zero file
offset. Inline extents at non-zero offsets is something btrfs is not
prepared for and results in all sorts of corruption and crashes on
future IO operations, such as the following BUG_ON() triggered by the
last write operation done by this test:
[152154.035903] ------------[ cut here ]------------
[152154.036424] kernel BUG at mm/page-writeback.c:2286!
[152154.036424] invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
(...)
[152154.036424] RIP: 0010:[<
ffffffff8111a9d5>] [<
ffffffff8111a9d5>] clear_page_dirty_for_io+0x1e/0x90
(...)
[152154.036424] Call Trace:
[152154.036424] [<
ffffffffa04e97c1>] lock_and_cleanup_extent_if_need+0x147/0x18d [btrfs]
[152154.036424] [<
ffffffffa04ea82c>] __btrfs_buffered_write+0x245/0x4c8 [btrfs]
[152154.036424] [<
ffffffffa04ed14b>] ? btrfs_file_write_iter+0x150/0x3e0 [btrfs]
[152154.036424] [<
ffffffffa04ed15a>] ? btrfs_file_write_iter+0x15f/0x3e0 [btrfs]
[152154.036424] [<
ffffffffa04ed2c7>] btrfs_file_write_iter+0x2cc/0x3e0 [btrfs]
[152154.036424] [<
ffffffff81165a4a>] __vfs_write+0x7c/0xa5
[152154.036424] [<
ffffffff81165f89>] vfs_write+0xa0/0xe4
[152154.036424] [<
ffffffff81166855>] SyS_pwrite64+0x64/0x82
[152154.036424] [<
ffffffff81465197>] system_call_fastpath+0x12/0x6f
(...)
[152154.242621] ---[ end trace
e3d3376b23a57041 ]---
This issue is addressed by the following linux kernel patch for btrfs:
"Btrfs: fix file corruption after cloning inline extents".
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
btrfs: test to exercise shared extent reference accounting
Regression test for adding and dropping an equal number of references
for file extents. Verify that if we drop N references for a file extent
and we add too N new references for that same file extent in the same
transaction, running the delayed references (which always happens at
transaction commit time) does not fail.
The regression was introduced in the 4.2-rc1 Linux kernel and fixed by
the patch titled: "Btrfs: fix order by which delayed references are run".
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
George Wang [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
xfs/015: keep create_file running until growfs finished
create_file may run over before growfs, which depends on many reasons. such as
the schedule algorithm, the workload of testing machine, etc. we should always
make sure the create_file run over after growfs, then we can get the valid
result of this test.
Signed-off-by: George Wang <xuw2015@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
ext4: test migration to non-extent based file format
On unpatched kernel, converting file with a hole at the beginning to
non-extent based format results in ext4 i_blocks corruption. Add a new
regression test case for it.
These two commits fixed the corruption:
ext4: be more strict when migrating to non-extent based file
ext4: correctly migrate a file with a hole at the beginning
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Brian Foster [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
generic: xattr enospc cleanup test
XFS had a regression where inode reclaim in the unlink codepath would
not correctly tear down extended attribute forks where no xattr extents
are present. Add a generic test to create this condition.
The test sets extended attributes on a series of files under ENOSPC
conditions and then verifies that the files can be removed without
syslog warnings or errors.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Wang Yanfeng [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
generic: busy loop of dd and rm test
Add a case for testing whether writing failed on NO_SPACE in a busy
loop of write and delete when disk almost full. It is a long-term
problem since very beginning in btrfs, and has been fixed by
patchset titled "btrfs: Fix no_space on dd and rm loop" from
zhaolei@cn.fujitsu.com.
Signed-off-by: Wang Yanfeng <wangyf-fnst@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
generic: test for fsync after file truncations
Test that if we truncate a file to a smaller size, then truncate it to
its original size or a larger size, then fsyncing it and a power failure
happens, the file will have the range [first_truncate_size, last_size[
with all bytes having a value of 0x00 if we read it the next time the
filesystem is mounted.
This test is motivated by a bug found in btrfs, which is fixed by a patch
titled: "Btrfs: fix fsync after truncate when no_holes feature is enabled"
Tested against ext3/4, xfs, btrfs (with and without the fix, and with the
no_holes feature disabled), f2fs, reiserfs and nilfs2.
All filesystems pass the test except for unpatched btrfs with the
no_holes feature enabled (as expected) and f2fs. Both produce the
following file contents that differ from the golden output:
File foo content after log replay:
0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
*
0200000 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
*
0372000
File bar content after log replay:
0000000 ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee
*
0200000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
*
0372000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0772000
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
generic: test for truncating a file into the middle of a hole
Test that after truncating a file into the middle of a hole causes the
new size of the file to be persisted after a clean unmount of the
filesystem (or after the inode is evicted). This is for the case where
all the data following the hole is not yet durably persisted, that is,
that data is only present in the page cache.
This test is motivated by an issue found in btrfs, which got fixed by
the patch titled:
"Btrfs: fix shrinking truncate when the no_holes feature is enabled"
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
fstests: remove $seqres.full before tests run
Some tests append logs to $seqres.full and never remove the log, which
keeps the log file growing. Remove $seqres.full before test in
following tests:
ext4/271
generic/019
generic/269
generic/270
shared/272
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Lukas Czerner [Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)]
generic: test zero range crossing isize within single block
Exercise the situation that cause ext4 to BUG_ON() when we use
zero range to zero a range which starts within the isize but ends
past the isize but still in the same block. This particular problem
has only been seen on systems with page_size > block_size.
This tests exercises the problem fixed in kernel with commit
0f2af21aae11972fa924374ddcf52e88347cf5a8
ext4: Allocate entire range in zero range
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Tue, 4 Aug 2015 04:10:48 +0000 (14:10 +1000)]
generic: concurrent IO test with mixed IO types
Test concurrent buffered I/O, DIO, AIO, mmap I/O and splice I/O on the
same files.
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Tue, 4 Aug 2015 04:10:48 +0000 (14:10 +1000)]
common: add filter to _check_dmesg
Introduce a parameter to _check_dmesg which allows callers to provide a
customized filter function to filter out intentional dmesg logs. The
default filter is a simple 'cat' command.
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Tue, 4 Aug 2015 04:10:48 +0000 (14:10 +1000)]
common: move _check_dmesg to common/rc
Move _check_dmesg to common/rc so that tests could call it directly.
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Josef Bacik [Tue, 4 Aug 2015 04:10:48 +0000 (14:10 +1000)]
generic: add fiemap test that does prealloc
I noticed that btrfs wasn't setting unwritten on prealloc test, and then
subsequently noticed that we weren't testing fiemap on prealloc extents with the
fiemap-tester. This patch adds another test that does the same as generic/225
only with prealloc enabled. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Josef Bacik [Tue, 4 Aug 2015 04:10:48 +0000 (14:10 +1000)]
fiemap-tester: convert to use O_DIRECT
We want to test fiemap, so we want to lay out a file exactly a certain way. XFS
tries to be smart and will allocate data in a hole if the write pattern is
[data][hole][data]
where the hole is small enough. This screws with fiemap-tester sometimes, so
make it easy and just do O_DIRECT so that we get the layout we want and can get
back to testing fiemap. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Tue, 4 Aug 2015 04:10:48 +0000 (14:10 +1000)]
shared: test for fsync after adding xattrs to a file
This test is motivated by an issue found in btrfs.
It test that after syncing the filesystem, adding many xattrs to a file,
syncing the filesystem again, writing to the file and then doing a fsync
against that file, all the xattrs still exists after a power failure.
That is, after the fsync log/journal is replayed, the xattrs still exist
and with the correct values.
The btrfs issue is fixed by the patch titled:
"Btrfs: fix fsync xattr loss in the fast fsync path"
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Tue, 4 Aug 2015 04:10:48 +0000 (14:10 +1000)]
generic: test for fsync after adding hard link to a file
This test is motivated by an issue found in btrfs.
It tests that after syncing the filesystem, adding a hard link to a file,
syncing the filesystem again, doing a write to the file that increases
its size and then doing a fsync against that file, durably persists the
data written to the file. That is, after log/journal replay, the data
is available.
The btrfs issue is fixed by the commit titled:
"Btrfs: fix fsync data loss after append write"
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Ari Sundholm [Tue, 4 Aug 2015 04:10:48 +0000 (14:10 +1000)]
awk invocation cleanup for busybox support.
These changes make it possible to run more of the tests on busybox.
Signed-off-by: Ari Sundholm <ari@tuxera.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Omar Sandoval [Tue, 4 Aug 2015 04:10:48 +0000 (14:10 +1000)]
btrfs: test premature submount unmounting when deleting default subvolume
Add a regression test for a problem where attempting to delete the
default subvolume would fail (as expected), but not until after all
submounts under the subvolume were unmounted.
Signed-off-by: Omar Sandoval <osandov@osandov.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Brian Foster [Tue, 4 Aug 2015 04:10:48 +0000 (14:10 +1000)]
xfs: test inode allocation with fragmented free space
XFS dynamic inode allocation has a fundamental limitation in that an
inode chunk requires a contiguous extent of a minimum size. Depending on
the level of free space fragmentation, inode allocation can fail with
ENOSPC where the filesystem might not be near 100% usage.
The sparse inodes feature was implemented to provide an inode allocation
strategy that maximizes the ability to allocate inodes under free space
fragmentation. This test fragments free space and verifies that
filesystems that support sparse inode allocation can allocate a minimum
percentage of inodes on the fs.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Dongsheng Yang [Tue, 4 Aug 2015 04:10:48 +0000 (14:10 +1000)]
btrfs/022: add a quota rescan -w to wait rescan finished.
When we enable quota, btrfs will rescan quota numbers. We need
to wait the rescan finished before any more operations on btrfs
qgroups. Otherwith, the new btrfs-progs would WARN out:
WARNING: Rescan is running, qgroup data may be incorrect.
It would make btrfs/022 failed.
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Tue, 4 Aug 2015 04:10:48 +0000 (14:10 +1000)]
xfs: test rw remount on norecovery ro mount
Commit
bbe051c841d5 ("xfs: disallow ro->rw remount on norecovery mount")
disabled rw remount on norecovery ro mount, this test makes sure the
behavior is correct.
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Tue, 4 Aug 2015 04:10:48 +0000 (14:10 +1000)]
generic/081: wait for lv to be settled before creating fs on it
Call 'udevadm settle' or 'udevsettle' or 'sleep 1' to make sure new lv
is ready for use before making filesystem on it, depends on which
command is available on the system.
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Wang Sheng-Hui [Tue, 4 Aug 2015 04:10:44 +0000 (14:10 +1000)]
generic/288: correct the testcase description
The testcase tests 2 corner cases:
Length is zero
Length is smaller than block size
Correct the beginning description by changing "of" to "or".
Signed-off-by: Wang Sheng-Hui <shhuiw@foxmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Dave Chinner [Tue, 4 Aug 2015 04:10:44 +0000 (14:10 +1000)]
xfs: test extent size hint size overflows
In certain cases, the extent size hints can cause maximum extent
size overflows resulting in extent tree corruptions. This test
exercises the original reproducer, and another corner case
demonstrated to expose problems on 1k block size filesystems.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
--
Version 2:
- TESTDIR->TEST_DIR
- append output to $seqres.full
Theodore Ts'o [Tue, 4 Aug 2015 04:10:44 +0000 (14:10 +1000)]
fsstress: add the -c option
This option causes fsstress to delete the test directory between each
run. This is the opposite from the ltp version of fsstress, which
deletes the test directory by default, and the -c option caused ltp's
fsstress _not_ to delete the test directory.
It can be useful to be able to have the same test behavior as ltp
version, and although reversing the sense of the option is
unfortunate, it also reserves the -c option, which makes it a bit
easier if we want to eventually have one version which is a superset
of the xfstest and ltp version of fsstress.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Theodore Ts'o [Tue, 4 Aug 2015 04:10:44 +0000 (14:10 +1000)]
fsstress: add the [-l loops] option
This feature is in the ltp version of fsstress; port it into
xfstests.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Matthew Wilcox [Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)]
config: Fix sysfs paths for partitions
generic/019 was failing with:
./tests/generic/019: line 65: /sys/block/pmem0p2/make-it-fail: No such file or directory
When using a partition, the file needed is located at
/sys/block/pmem0/pmem0p2/make-it-fail.
Rather than attempt to deduce whether a block device is a partition
or not, use the symlinks located in /sys/dev/block/ to find the right
location for the make-it-fail file.
Also change btrfs/088 to use the new _sysfs_dev function.
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Wang Sheng-Hui [Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)]
xfstests: correct comment in generic/135
xfs_io '-d' specifies direct IO, not sync IO.
Signed-off-by: Wang Sheng-Hui <shhuiw@foxmail.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Josef Bacik [Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)]
generic: add a test for fallocate+truncate
There was some confused about what the fs was supposed to do when you truncate
at i_size with preallocated space past i_size. We decided on the following
things
1) truncate(i_size) will trim all blocks past i_size.
2) truncate(x) where x > i_size will not trim all blocks past i_size.
This test is to make sure we're all acting sanely. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eric Sandeen [Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)]
xfs/111: make it work better
xfs/111 is failing today, primarily because it obliterates the
root inode chunk and the verifiers fail the mount - i.e. the test
fails to properly test the thing it's meant to test.
Change the test so that the induced corruption is further into the
filesystem, but still hitting the inodes which have been created
for the test, so that the fs can mount and continue.
This requires that the helper binary (itrash) take an offset, which
we will figure out by using xfs_db.
This changes the locations of the inodes we hit; we're not really
going to be able to predict that terribly well, so remove the
output which shows inode offsets, and just keep track of whether
we managed to obliterate any at all.
The test still fails, because the fs is corrupted; this was done
intentionally, so run xfs_repair before the test exits to fix
things up.
(This test doesn't run often; it's not in the auto group, and
all the failures are extremely noisy and time consuming...)
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Brian Foster [Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)]
xfs/007: use gquotino for project quotas on pre-v5 superblocks
This test checks block usage on quota inodes based on the inode number
values stored in the superblock. Version 5 superblocks (crc=1) have an
independent project quota inode field to support concurrent group and
project quotas. Older superblocks do not have the pquotino field. The
gquotino field is reused for project quotas.
The test currently unconditionally uses the pquotino field to determine
the project quota inode. This causes failures on pre-v5 superblocks as
the test queries the block usage of an incorrect inode number. Update
the test to use gquotino as the project quota inode on such filesystems.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Omer Zilberberg [Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)]
_require_command: quote commands correctly
fixes
9435b92 common: _require_command needs to handle parameters
Also quoted $_command because _require_command may be called with an
empty $1 parameter, e.g.:
_require_command "$MY_UTIL_PROG" my_util # but $MY_UTIL_PROG is empty
[ -x ] returns true.
[ -x "" ] returns false, as required here.
Signed-off-by: Omer Zilberberg <omzg@plexistor.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Andrew Price [Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)]
generic/082: add to the quota group
generic/082 is a quota test so it should be in this group.
Signed-off-by: Andrew Price <anprice@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Andrew Price [Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)]
common: set VFS_QUOTA for gfs2
Use generic quota tools with gfs2.
Fixes "xfs_quota: cannot setup path for mount /mnt/scratch: No such
device or address"
Signed-off-by: Andrew Price <anprice@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eric Sandeen [Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)]
xfs/032: properly test for corruption from xfs_copy
From the xfs_repair manpage:
xfs_repair run without the -n option will always return
a status code of 0.
So we must use "-n" to detect corruption in this test.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eric Sandeen [Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)]
xfs: test repairing false positive reserved attr name use
xfs_repair compares attr names in the root namespace to
two special/reserved names, "SGI_ACL_FILE" and "SGI_ACL_DEFAULT"
and if the value in them aren't valid acls, flags this as
an inconsistency.
However, due to various bugs, xfs_repair may only compare
a smaller portion of the on-disk value; hence either
substrings or superstrings may match, and false-positive
corruption will be detected. This test checks for those
false positives; i.e. the ACL names created in this test
may cause xfs_repair to "fix" them, but it should not.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Andreas Gruenbacher [Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)]
generic/087,126: Test the permission to set file times
Check if setting the file access and modification times to the current time
and to a specific timestamp is allowed when expected.
In generic/126, remove a left-over temporary file.
Signed-off-by: Andreas Gruenbacher <andreas.gruenbacher@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)]
xfs: be compatible with older mkfs.xfs which has no v5 support
With the change to CRCs by default, some tests are updated to call mkfs
with "-m crc=0" option directly, and this breaks testings on older
distros where mkfs.xfs doesn't have crc support.
Introduce a new variable to tell if mkfs.xfs supports v5 xfs and do
tweaks in _scratch_mkfs_xfs_opts() based on it.
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Dave Chinner [Tue, 26 May 2015 02:51:56 +0000 (12:51 +1000)]
generic/275: writes may not partially succeed
When a large IO is done as a single buffer, there is no guarantee
that it will partially succeed when close to ENOSPC. The test
assumes that the kernel is going to break the write down into
smaller chunks (i.e. buffered IO breaking it down into PAGE_SIZE
allocations), but certain configurations will not do this. e.g.
extent size hints are set or DAX is being used) and hence the large
write fails completely as there is not space for the entire
allocation to be made.
Hence break the final write in the test up into multiple small
writes, thereby acheiving the same effect - ensuring that we can
write more data after removing some space....
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Dave Chinner [Tue, 26 May 2015 02:51:53 +0000 (12:51 +1000)]
generic/223, xfs/203: IO is not well aligned
On certain configurations (e.g. MOUNT_OPTIONS="-o dax") we get
different allocation patterns due to the writes being done in
multiple pwrite() calls. e.g. the write is 8k, but the buffer size
is 4k, and so the filesystem sees 4k writes. If the filesytem is not
using delayed allocation, then the allocation context is a 4k write
rather than an 8k write and so they don't get appropriately aligned.
Fix this by making the write buffer the same size and the writes
being done.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Dave Chinner [Tue, 26 May 2015 02:50:53 +0000 (12:50 +1000)]
generic/018: use xfs_io and larger buffers for writes
The test currently uses 'dd' directly for writing to files; instead
we should be using the xfs_io pwrite command.
Also, when we have a configuration that does not do delayed
allocation (e.g. dax), there is no guarantee that the files will be
allocated in the pattern expected, so do all the writes from a
single buffer so the kernel can allocate extents in the manner the
test expects as much as possible.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Andreas Gruenbacher [Thu, 14 May 2015 10:27:54 +0000 (20:27 +1000)]
generic: Fix _is_block_dev quoting
Add more quoting so that test cases that don't require a SCRATCH_DEV
won't fail.
Signed-off-by: Andreas Gruenbacher <andreas.gruenbacher@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Thu, 14 May 2015 10:27:54 +0000 (20:27 +1000)]
check: set failure status before exit
check has trapped 'exit 1' and exit with $status, but check always
returns 0 on error because status never gets updated. This causes
problems while running some tests in a loop until it fails, e.g.
while ./check generic/081; do : ; done
Just set status to 1 before exit, as what we do in the tests.
Also remove an unused $flag while we're at it.
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Omer Zilberberg [Thu, 14 May 2015 10:27:53 +0000 (20:27 +1000)]
generic/076: fixed incorrect fsstress parameters
Test was not run because directory parameter was omitted.
Signed-off-by: Omer Zilberberg <omzg@plexistor.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Thu, 14 May 2015 10:27:53 +0000 (20:27 +1000)]
btrfs: test for send with compressed file extents
Test that an incremental send issues valid clone operations for
compressed file extents.
For some compressed extents, namely those referred by a file extent item
with a non-zero data offset, btrfs could issue a clone operation in the
send stream with an offset and length pair that were not entirely
contained in the source file's range, causing the receiving side to get
-EINVAL errors from the clone ioctl when attempting to perform the clone
operations.
This issue was fixed by the following linux kernel btrfs patch:
Btrfs: incremental send, fix clone operations for compressed extents
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Thu, 14 May 2015 10:27:53 +0000 (20:27 +1000)]
btrfs: regression test for file range cloning
Test btrfs file range cloning with the same file as a source and
destination.
This tests a specific scenario where the extent layout of the file
confused the clone ioctl implementation making it return -EEXIST to
userspace. This issue was fixed by the following linux kernel patch:
Btrfs: fix range cloning when same inode used as source and destination
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Dave Chinner [Thu, 14 May 2015 02:20:11 +0000 (12:20 +1000)]
filter: inode size output of mkfs.xfs can change
With the change to CRCs by default, the mkfs inode size is defaults
to 512 bytes and the minimum block size changes to 1024 bytes. This
causes mismatches with golden output that expects the inode size to
be 256 bytes, and some tests are tailored around the amount of space
inside a 256 byte inode. Fix them with appropriate filtering or mkfs
parameters to allow 256 byte inodes to be used.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Dave Chinner [Thu, 14 May 2015 02:19:41 +0000 (12:19 +1000)]
xfs/045: can't change UUID on v5 filesystems.
So pass "-m crc=0" to the scratch_mkfs command so that we only run
on old v4 format filesystems where the UUID can be changed.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Dave Chinner [Thu, 14 May 2015 02:18:29 +0000 (12:18 +1000)]
filter: latest xfs_repair is more verbose
It detects more errors, so we need to filter them out to prevent
golden image mismatches on successful recovery.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Dave Chinner [Thu, 14 May 2015 02:17:29 +0000 (12:17 +1000)]
filter: latest mkfs.xfs makes logical sector size noise
On devices that have a logical sector smaller than physical sector,
this extra, harmless output now occurs:
QA output created by 060
+specified blocksize 1024 is less than device physical sector size 4096
+switching to logical sector size 512
Creating directory system to dump using src/fill.
Setup .......................................
Dumping to files...
And it causes lots of tests to fail unnecessarily. Filter it.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Anand Jain [Mon, 4 May 2015 12:56:13 +0000 (22:56 +1000)]
xfstests: btrfs: 020 is bit diverted from its objective
Not sure what this test case wanted to achieve by deleting the
source device before the replace.
As per the comments the objective of this test case seems to be
~~~~
btrfs device replace test on RO fs
Regression test for commit:
bbb651e Btrfs: don't allow the replace procedure on read only filesystems
~~~~~
Also there won't be EIO when you delete a loop device when its
still mounted. as shown below.
mount /dev/loop0 /mnt
losetup -d /dev/loop0
echo $?
0
dd if=/dev/zero of=/mnt/tf1 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.
00192936 s, 265 kB/s
cd /mnt
sync
losetup -a
/dev/loop0: [0802]:
1291816 (/root/testdev/disk1)
No errors in the dmesg as well.
Instead of further confusing, I am deleting the delete loop device part
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Mon, 4 May 2015 12:56:13 +0000 (22:56 +1000)]
generic/204: use more space for inode allocation
On v4/512b and v5/1k xfs, there're not enough free inodes for new files
and generic/204 fails because of running out of inode not space.
Adding "-i maxpct=50" to MKFS_OPTIONS to bump up the inode limit at mkfs
time, and test could pass on all configurations.
Suggested-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Mon, 4 May 2015 12:56:13 +0000 (22:56 +1000)]
shared/289: do not special-case ext3
Commit "
3574531 xfstests: count journal size in test 289" makes ext3 a
special case, but now it's not the case anymore after kernel commit
2046fd1 ext3: Count journal as bsddf overhead in ext3_statfs
So just remove the special case, now test passes on both ext3 and ext4,
also ext3 driven by ext4 module.
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Mon, 4 May 2015 12:56:13 +0000 (22:56 +1000)]
generic: add _require_metadata_journaling to more tests
generic tests 039, 059 and 325 need _require_metadata_journaling too,
they use dm_flakey to trigger log replay. I've seen 039 and 059 failed
post-test fsck on ext2, 325 could possibly fail too.
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Lukas Czerner [Mon, 4 May 2015 12:56:13 +0000 (22:56 +1000)]
generic: test data corruption on ext4 caused by written/delayed extent
This test exercises the problem with unwritten and delayed extents
in ext4 extent status tree where we might in some cases lose a block
worth of data. Even though this was a ext4 specific problem the
reproducer can be easily run on any file system so let's do that just
in case.
This test exercises the problem fixed in kernel with commit
"ext4: Fix data corruption caused by unwritten and delayed extents"
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Mon, 4 May 2015 12:56:13 +0000 (22:56 +1000)]
btrfs: test btrfs send after swapping directory names differently
Test btrfs incremental send after renaming and moving directories around in a
way that ends up making a directory have different dentries with the same name
but pointing to different inodes in the parent and send snapshots, and also
inverting the ancestor-descendent relationship between one of those inodes and
some other inode.
Cases like this made an incremental send enter an infinite lopp when building
path strings, leading to -ENOMEM errors when the path string reached a length
of PATH_MAX.
This issue was fixed by the following linux kernel btrfs patch:
Btrfs: incremental send, check if orphanized dir inode needs delayed rename
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Qu Wenruo [Mon, 4 May 2015 12:56:13 +0000 (22:56 +1000)]
btrfs: Incorrect exclusive reference number after file clone.
[Problem]
Since commit
fcebe4562dec83b3f8d308 ("Btrfs: rework qgroup accounting"),
quota data update is delayed after delayed_ref calculation, and lacks
correct protection to detect root reference which shouldn't be counted
in current sequence number but already written into extent backref.
This makes exclusive reference not decreased correctly and give incorrect
result.
[Test procedure]
1. Create a btrfs with 3 subvolumes, quota enabled and rescanned.
2. Create a file in 1st subvolume
3. Clone the file to 2nd and 3rd subvolume
4. Sync the fs to reflect the changes in qgroup.
5. Check the qgroup data
[Expected result]
None of the subvolume has exclusive reference to the file.
[Actual result]
The first subvolume still have exclusive reference to the file.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Qu Wenruo [Mon, 4 May 2015 12:56:11 +0000 (22:56 +1000)]
btrfs: Check return value of "btrfs filesystem show" command
The return value should always be 0 if no problem happens, but
"btrfs filesystem show" executed on umounted device will always return 1
even there is no problem.
This testcase just checks it.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Mon, 4 May 2015 12:55:47 +0000 (22:55 +1000)]
generic: test fs freeze/unfreeze and mount/umount race
Exercise fs freeze/unfreeze and mount/umount race, which could lead to
use-after-free oops.
This commit fixed the issue:
1494583 fix get_active_super()/umount() race
This test case is based on a script from Monakhov Dmitriy.
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Mon, 4 May 2015 12:55:39 +0000 (22:55 +1000)]
shared: test truncate orphan inodes when mounting extN
ext4 should hold i_mutex when truncating orhpan inodes, or a WARNING
would be triggered. This commit fixed this issue.
721e3eb ext4: lock i_mutex when truncating orphan inodes
Though it's an ext4 specific issue, there's no harm to test on ext2/3
too, as debugfs is used to set orphan inode list.
This test is based on a script from Lukas Czerner.
Signed-off-by: Eryu Guan <eguan@redhat.com>
Acked-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>