Filipe Manana [Wed, 21 Jan 2015 05:01:25 +0000 (16:01 +1100)]
generic: test fsync on inode with many hard links differently
This test is motivated by an fsync issue discovered in btrfs.
The steps to trigger the issue were:
1) remove an hard link from an inode with a large number of hard links;
2) add a new hard link;
3) add another hard link with the same name as the one removed in step 1;
4) fsync the inode.
These steps made the btrfs fsync log replay fail (with the -EOVERFLOW
error), making the filesystem unmountable, requiring the use of
btrfs-zero-log (it wipes the fsync log) in order to make the filesystem
mountable again (but losing some data/metadata).
The btrfs issue was fixed by the following linux kernel patches:
Btrfs: fix fsync when extend references are added to an inode
Btrfs: fix fsync log replay for inodes with a mix of regular refs and extrefs
This issue was present in btrfs since the extrefs (extend references)
feature was added (2012).
Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Wed, 21 Jan 2015 05:00:01 +0000 (16:00 +1100)]
generic: test fsync on inode with many hard links
This test is motivated by an fsync issue discovered in btrfs.
The issue in btrfs was that adding a new hard link to an inode that
already had a large number of hardlinks and fsync the inode, would
make the fsync log replay code update the inode with a wrong link count
(smaller than the correct value). This resulted later in dangling
directory index entries, after removing most of the hard links
(correct_value - wrong_value), that were visible to user space but it
was impossible to delete them or do any other operation on them (since
they pointed to an inode that didn't exist anymore, resulting in -ESTALE
errors).
The btrfs issue was fixed by the following linux kernel patch:
Btrfs: fix fsync when extend references are added to an inode
This issue was present in btrfs since the extrefs (extend references)
feature was added (2012).
Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Wed, 21 Jan 2015 04:58:23 +0000 (15:58 +1100)]
generic: test fsync after unlink
This test is motivated by an fsync issue discovered in btrfs.
The issue was that after fsyncing an inode that got its link count
decremented, and the new link count is greater than zero, after the
fsync log replay the inode's parent directory metadata became
inconsistent - it had a wrong i_size and dangling index entries which
prevented the directory from ever being removed (rmdir always failed
with -ENOTEMPTY, even if the directory had no more child inodes).
The btrfs issue was fixed by the following linux kernel patch:
Btrfs: fix directory inconsistency after fsync log replay
Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Wed, 21 Jan 2015 04:57:03 +0000 (15:57 +1100)]
common: fix function _require_batched_discard()
Commit 01d42b7efe3fcb9169befda3072c41d25a87c920 broke the check
for the success status of running fstrim. The [ ] bracets should
have been killed. This made several tests being skipped even when
the test/scratch devices support trim/discard.
Xing Gu [Wed, 24 Dec 2014 03:56:17 +0000 (14:56 +1100)]
xfs/111: fix cp of missing file
After installing the test suite, src directory only contains binary
programs in the final building directory. Here executing "cp src/itrash.c
$SCRATCH_MNT/${I}" will output "cp: cannot stat 'src/itrash.c': No
such file or directory" error message. Fix it.
Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Theodore Ts'o [Wed, 24 Dec 2014 03:53:10 +0000 (14:53 +1100)]
ext4/004: limit the amount of data written so test runs faster
Previously this test was taking 6-7 minutes, and writing half a
gigabyte of data in the dump/restore test directory. Change this to
be about 60 megs, and to take ~20 seconds.
Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
xfs/071 2s
_check_xfs_filesystem: filesystem on /dev/sda6 is inconsistent (r) (see /root/xfstests/results//xfs/071.full)
xfs/072 1s
Ran: xfs/071 xfs/072
Passed all 2 tests
[root@hp-dl388eg8-01 xfstests]# echo $?
0
Usually it's not a problem, but it does confuse scripts that depend on
return value of check. Update check to treat _check_{test,scratch}_fs
failures as test failures too, new test output is like
Eryu Guan [Wed, 24 Dec 2014 03:51:04 +0000 (14:51 +1100)]
common: exit only if tests find corruption
If _check_xxx_filesystem called by tests when corruption found
they exit, but we don't want the calls from the test harness itself to
exit when corruption is found.
_check_xfs_filesystem already behaves correctly, make
_check_generic_filesystem and _check_btrfs_filesystem follow the same
behavior.
Signed-off-by: Eryu Guan <eguan@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Liu Bo [Wed, 24 Dec 2014 03:48:23 +0000 (14:48 +1100)]
btrfs: add test case for qgroup account on shared extents
This is a regression test of
'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
it's used to verify that removing shared extents can end up incorrect
qgroup accounting.
It can produce qgroup related warnings.
The fix is https://patchwork.kernel.org/patch/5499981/
"Btrfs: fix a warning of qgroup account on shared extents"
Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Tested-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Dushan Tcholich [Mon, 15 Dec 2014 23:53:57 +0000 (10:53 +1100)]
common: unify _require_batched_discard
To check for FITRIM tests used _require_fstrim() and
_test_batched_discard() but as _test_batched_discard() already
includes _test_fstrim() unify FSTRIM check throughout xfstests with
_require_batched_discard().
Signed-off-by: Dushan Tcholich <dusanc@gmail.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Theodore Ts'o [Mon, 15 Dec 2014 23:53:57 +0000 (10:53 +1100)]
ext4/308: require fallocate support
These tests use the falloc command in xfs_io, and there are some file
systems (ext3) or file system configurations (ext4 in ext3
compatibility mode) which do not support fallocate. So add the
explicit requirement to avoid false test failures.
Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Mon, 15 Dec 2014 23:53:42 +0000 (10:53 +1100)]
btrfs: add regression test for clone ioctl
Regression test for a btrfs clone ioctl issue where races between
a clone operation and concurrent target file reads would result in
leaving stale data in the page cache. After the clone operation
finished, reading from the clone target file would return the old
and no longer valid data. This affected only buffered reads (i.e.
didn't affect direct IO reads).
This issue was fixed by the following linux kernel patch:
Filipe Manana [Mon, 15 Dec 2014 23:50:56 +0000 (10:50 +1100)]
fstests: btrfs, add test for snapshoting after file write + truncate
Regression test for a btrfs issue where if right after the snapshot
creation ioctl started, a file write followed by a file truncate
happened, with both operations increasing the file's size, the created
snapshot would capture an inconsistent state of the file system tree.
That state reflected the file truncation but it didn't reflect the
write operation, and left a gap between two file extent items (and
that gap corresponded to the total or a partial area of the write
operation's range).
This issue was fixed by the following linux kernel patch:
Btrfs: fix snapshot inconsistency after a file write followed by truncate
Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Mon, 15 Dec 2014 23:49:57 +0000 (10:49 +1100)]
generic/299: make sure fio really exits
Fix two problems in generic/299
1. Remove $seqres.full before test, otherwise the file is growing all
the time.
2. Make sure fio really exits, otherwise fio would block umount. $pid is
the pid of function run_check not fio, sometimes fio is still there when
$pid is dead and blocking umount.
David Disseldorp [Mon, 15 Dec 2014 23:48:51 +0000 (10:48 +1100)]
cifs: add missing Makefile
This fixes the make install target, which traverses all tests/*
subdirectories.
Reported-by: David Drysdale <drysdale@google.com> Signed-off-by: David Disseldorp <ddiss@suse.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Vishal Verma [Fri, 12 Dec 2014 00:26:56 +0000 (11:26 +1100)]
ext4: the _require checks for bigalloc need a larger fs size
_require_ext4_bigalloc and _require_ext4_mkfs_bigalloc create a
200k fs. DAX (as XIP before it) relies on a fs block size ==
system page size; ie 4k for us. With a 200k fs size limit,
mkfs refuses to create a filesystem with a 4k block size, so
the check fails, but for a bogus reason.
Increasing the fs size to 512m allows mkfs to create a filesystem
with 4k block size, so the test passes.
Signed-off-by: Vishal Verma <vishal.l.verma@linux.intel.com> Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
David Disseldorp [Fri, 12 Dec 2014 00:24:10 +0000 (11:24 +1100)]
cifs: add server-side copy sanity test
This test uses the cloner binary to issue CIFS_IOC_COPYCHUNK_FILE
server-side copy requests.
Signed-off-by: David Disseldorp <ddiss@suse.de> Acked-by: Steve French <smfrench@gmail.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
David Disseldorp [Fri, 12 Dec 2014 00:23:06 +0000 (11:23 +1100)]
common: rename _require_btrfs_cloner to _require_cloner
src/cloner.c is no longer Btrfs specific, so use a generic name.
Signed-off-by: David Disseldorp <ddiss@suse.de> Acked-by: Steve French <smfrench@gmail.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Fri, 12 Dec 2014 00:07:22 +0000 (11:07 +1100)]
btrfs: add test to stress chunk allocation/removal and fstrim
Stress btrfs' block group allocation and deallocation while running
fstrim in parallel. Part of the goal is also to get data block groups
deallocated so that new metadata block groups, using the same physical
device space ranges, get allocated while fstrim is running. This caused
several issues ranging from invalid memory accesses, kernel crashes,
metadata or data corruption, free space cache inconsistencies, free
space leaks and memory leaks.
Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Xiaoguang Wang [Thu, 11 Dec 2014 23:56:26 +0000 (10:56 +1100)]
ext4: add dump/restore test
This test case will first use fsstress to fill a file system, then
dump it to standard output and restore it from standard input, finally
check that the original contents and the new contents generated by
restore tool will be same.
Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Steve French [Thu, 11 Dec 2014 23:55:29 +0000 (10:55 +1100)]
common: update README to list build dependencies
Add sample list of packages (dependencies) required to build XFSTESTS
and add a step to the instructions to mention creating the test
user needed for some of the ACL tests.
Signed-off-by: Steve French <smfrench@gmail.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Dave Chinner [Thu, 11 Dec 2014 23:55:15 +0000 (10:55 +1100)]
xfs/096: strip log stripe warnings from mkfs.xfs
The warnings have been removed when stripe unit/width are too big
for the log stripe unit to be set. Hence add them to the mkfs.xfs
filter and strip them from golden output file so the test succeeds
on both new and old mfks binaries.
Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
generic: add test to verify xattr replace operations are atomic
This test verifies that replacing a xattr's value is an atomic
operation. This is motivated by an issue in btrfs where replacing
a xattr's value wasn't an atomic operation, it consisted of
removing the old value and then inserting the new value in a
btree. This made readers (getxattr and listxattrs) not getting
neither the old nor the new value during a short time window.
Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Brian Foster [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
xfs/062: verify bulkstat finds all inodes
The bulkstat mechanism is used by xfsdump and other tools to index all
inodes allocated in a filesystem. Run some simple tests with varying
inode layouts and bulkstat batch sizes to verify bulkstat finds the
expected number of inodes.
Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
common: use _scratch_mount helper in _require_relatime()
Change the way how _require_relatime() mount $SCRATCH_DEV, use
_scratch_mount helper so $SCRATCH_DEV is mounted with selinux context,
to avoid "same superblock, different selinux context" failure.
Signed-off-by: Eryu Guan <eguan@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Eryu Guan [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
common: re-enable tests that require scratch dev on NFS
Commit c041421 ("xfstests: stop special casing nfs and udf")
disables tests requires scratch dev running on NFS. Add the
infrastructure needed to re-enable them to get a larger test
coverage on NFS.
Signed-off-by: Eryu Guan <eguan@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Anna Schumaker [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
common: Fixes for testing NFS over IPv6
When testing NFS over IPv6, the user may set a $TEST_DEV of the form
[fe80::42]:/export. The use of square brackets surrounding the IPv6
address is an accepted convention, but grep and awk think that our IPv6
address is actually a regex and tries to evaluate it instead. The
result is that xfstests reports our filesystem "is busy or already
mounted".
This patch fixes the IPv6 problem by telling awk and grep to treat
$TEST_DEV as a fixed string rather than a regex.
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Liu Bo [Mon, 10 Nov 2014 07:01:07 +0000 (18:01 +1100)]
aio: fix memory corruption in aio-last-ref-held-by-io
This's been detected by testing generic/323 on btrfs, it keeps
producing chaos of checksum errors.
It is because aio-last-ref-held-by-io uses a static buffer that is
been used repeatedly for every io_submit() call, but we'll issue
NUM_IOS(=16) io_sumbit() in a 'for' loop at a time, and when those
data read by aio has not finish its endio(), its memory is likely to
be used in the next io_submit, which ends up data corruption and
numerous checksum errors.
This allocates memory for each io_submit() and generic/323 runs fine
after this.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Jan Kara [Mon, 10 Nov 2014 02:05:22 +0000 (13:05 +1100)]
xfs/195: Use XFSDUMP_PROG instead of xfsdump directly
Use appropriate environment variable (XFSDUMP_PROG) instead of
hardcoding 'xfsdump' name. Also make the test fail graciously when
xfsdump isn't installed.
We also make XFSDUMP_PROG be equal to empty string instead of -e when
xfsdump isn't installed. The changes require some tweaking to output
filtering since full command path now appears in the output.
Signed-off-by: Jan Kara <jack@suse.cz> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Qu Wenruo [Mon, 10 Nov 2014 02:04:00 +0000 (13:04 +1100)]
btrfs: regression test for btrfs extent merge
The following kernel commit introduced the bug: 51f395ad btrfs: Use right extent length when inserting overlap extent map.
When btrfs commit race with btrfs_get_extent(), merge_extent_mapping()
may build up a new extent which length overflows and cause extent map
insert fail, causing the caller get a -EEXIST error.
This regression is fixed by the following patches:
btrfs: Fix and enhance merge_extent_mapping() to insert best fitted extent map
btrfs: Fix the wrong condition judgment about subset extent map
Cc: Filipe Manana <fdmanana@suse.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Tested-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Eric Sandeen [Tue, 14 Oct 2014 11:59:39 +0000 (22:59 +1100)]
xfs: test larger dump/restore to/from file
This test creates a large-ish directory structure using
fsstress, and does a dump/restore to make sure we dump
all the files.
Without the fix for the regression caused by: c7cb51d xfs: fix error handling at xfs_inumbers
we will see failures like:
-xfsrestore: 486 directories and 1590 entries processed
+xfsrestore: 30 directories and 227 entries processed
as it fails to process all inodes.
I think that existing tests have a much smaller set of files,
and so don't trip the bug.
I don't do a file-by-file comparison here, because for some
reason the diff output gets garbled; this test only checks
that we've dumped & restored the correct number of files.
Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Brian Foster [Tue, 14 Oct 2014 11:59:39 +0000 (22:59 +1100)]
xfs/053: test for stale data exposure via falloc/writeback interaction
XFS buffered I/O writeback has a subtle race condition that leads to
stale data exposure if the filesystem happens to crash after delayed
allocation blocks are converted on disk and before data is written back
to said blocks.
Use file allocation commands to attempt to reproduce a related, but
slightly different variant of this problem. The associated falloc
commands can lead to partial writeback that converts an extent larger
than the range affected by falloc. If the filesystem crashes after the
extent conversion but before all other cached data is written to the
extent, stale data can be exposed.
Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Tue, 14 Oct 2014 11:59:39 +0000 (22:59 +1100)]
btrfs: regression test for btrfs incremental send
This is a regression test for a btrfs incremental send issue.
If between two snapshots we rename an existing directory named X to Y and
make it a child (direct or not) of a new inode named X, we were delaying
the move/rename of the former directory unnecessarily, which would result
in attempting to rename the new directory from its orphan name to name X
prematurely. This made btrfs receive fail with an error message like the
following:
rename o261-7-0 -> merlin/RC/OSD failed
This issue was a regression in the 3.16 kernel and got fixed by the
following linux kernel btrfs patch:
Btrfs: send, don't delay dir move if there's a new parent inode
Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
shared/032 2s ... 2s
_check_btrfs_filesystem: filesystem on /dev/sdc is inconsistent (see /root/xfstests-dev/results//shared/032.full)
Ran: shared/032
Passed all 1 tests
This is because xfstests will run fsck after each unit test,
for tests/shared/032, we have reformated SCRATCH_DEV to other fs,
fix this problem by skipping fsck here.
Signed-off-by: Wang Shilong <wangshilong1991@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Anna Schumaker [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
common: Re-enable testing over NFS
83ef157 (common: Check fs consistency on TEST_DEV only when needed) has
_require_test unconditionally return _notrun when testing on an NFS
filesystem, essentially disabling NFS. This patch changes the code to
validate $TEST_DEV and only call _notrun if validation fails.
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Wang Shilong [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs/010: use _extent_count() helper
cleanup to swith _extent_count(), this way we remove a
dependence on filefrag.
Signed-off-by: Wang Shilong <wangshilong1991@gmail.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Wang Shilong [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: add regression for inode bad compression ratio detection
This test add a regression test to make sure btrfs dosen't set
inode NOCOMPRESS flag when a small write(<=blocksize) happens.
Signed-off-by: Wang Shilong <wangshilong1991@gmail.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Wang Shilong [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
common: fix test for ltp/fsstress
Testing if FSSTRESS_PROG is a null string dosen't make sense because
it has just been set.
Here fix it by testing if it is an executable file.
Signed-off-by: Wang Shilong <wangshilong1991@gmail.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Dave Chinner [Tue, 14 Oct 2014 06:40:34 +0000 (17:40 +1100)]
xfs/007: check correct quota inodes
Commit b8cac56 ("xfs/007: add project quota Q_XQUOTARM test") has
been broken since it was added - the new code checked the group
quota inode rather than the project quota inode and so always
reported a pre-RM block count of zero. This occurred due to a copy
and paste of the existing user/group test code and didn't fix up all
the code properly.
Factor the common code into a single function, and pass in the
correct variables the tests require. While there, make sure that we
remove the 007.full file before the test starts to aid future
debugging and also check that project quotas are supported before
trying to test them.
Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Lukas Czerner [Tue, 14 Oct 2014 06:40:32 +0000 (17:40 +1100)]
generic/017: Do not create file systems with different block sizes
User takes care about specifying mkfs options he wishes to test and the
test itself should not change it if it's not strictly necessary for the
test itself.
In this case it is not necessary and we should only test configuration
provided by the user. Moreover if the block size was already specified
some mkfs utilities does not handle multiple of the same parameters and
the mkfs utility fails making it re-try with only provided options
(ignoring what user specified), which is wrong.
In this case it's also a problem for btrfs file system which does not
support block size < page size.
Fix it by removing the mkfs, and testing existing configuration only.
Signed-off-by: Lukas Czerner <lczerner@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Lukas Czerner [Tue, 14 Oct 2014 06:07:52 +0000 (17:07 +1100)]
common: Introduce get_block_size() helper
Currently many tests and other functions uses it's own way to get block
size of the file system. Introduce get_block_size(), a generic way to
get block size of mounted file system and use that instead.
Signed-off-by: Lukas Czerner <lczerner@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Mon, 29 Sep 2014 03:26:32 +0000 (13:26 +1000)]
generic: add dir fsync test
This test is motivated by a bug found in btrfs when replaying a
directory from the fsync log. The issue was that if a directory
entry is both found in the persisted metadata and in the fsync
log, at log replay time the directory got set with a wrong i_size.
This had the consequence of not being able to rmdir empty
directories (failed with errno ENOTEMPTY).
This was fixed in btrfs with the following linux kernel patch:
Btrfs: fix directory recovery from fsync log
Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
When fstests finds a miscompare it tries to dump the corrupted
bytes from the buffer, but due to an incorrect comparism actully
dumps the correct part of it.
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Dave Chinner <david@fromorbit.com>
XFS allocates extra indirect blocks for delayed allocation extents at
write time. When delalloc extents are split, the existing indirect block
reservation was historically divided up evenly among the new extents
even though the overall requirement for two extents could exceed the
requirement for the original. Repeated delalloc extent splits ultimately
leads to extents with 0 indirect blocks and in turn leads to assert
failures in XFS.
Add a test to stress indirect block reservation for delayed allocation
extents. The test converts a single delalloc extent to many and operates
on the remaining extents to detect or trigger potential problems.
Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Brian Foster [Mon, 29 Sep 2014 03:10:05 +0000 (13:10 +1000)]
generic/032: add xfs unwritten extent data corruption reproducer
XFS had a data corruption problem where writeback of pages to unwritten
extents would fail to run unwritten extent conversion at I/O completion.
This causes subsequent reads of written, but unconverted regions to
return zeroes. This occurs on sub-page block size filesystems when
writeback contends for the inode lock (e.g., with a file writer).
Add a test that creates the conditions to reproduce the data corruption
and detect it by looking for unwritten extents after all said extents
have been overwritten.
Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Dave Chinner [Mon, 29 Sep 2014 02:58:24 +0000 (12:58 +1000)]
generic: add write vs fcollapse test
This test exposed a problem with XFS where it failed to write back a
partial page correctly during a fcollapse operation. This left a
stray dirty buffer on the page, and hence invalidation of the page
then failed of the fcollapse returned an EBUSY error.
Make this a generic test so that we can ensure that all filesystems
handle the case correctly. Test case originally worked out and
written by Brian Foster.
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 [Mon, 29 Sep 2014 02:57:37 +0000 (12:57 +1000)]
generic: add mmap write vs truncate/remap test
This test exposed a problem with mapped writes to the tail page of a
file in XFS and potentially ext4. Eric did all the hard work of
taking the bug report and generating the reproducable test case on
ext4. Make it a generic test so that we can ensure that all
filesystems handle the case correctly.
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 [Mon, 29 Sep 2014 02:56:48 +0000 (12:56 +1000)]
generic: add mmap write vs truncate test
This test exposed a problem with mapped writes to the tail page of a
file in XFS. Hence make it a generic test so taht we can ensure that
all fielsystems handle the case correctly.
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 [Mon, 29 Sep 2014 02:56:16 +0000 (12:56 +1000)]
generic: more tests should clean up TESTDIR on success
I'm getting enospc errors on a 4GB test device after a while of
running. Part of the issue is that many tests can't or don't clean
up previous failed runs when they start or if the run to success.
Hence while we want to slowly age the test filesystem, we don't
really want that aging to unintentionally run the filesystem out of
space. To that end:
We can see that there are a few tests that using most of the space.
These are often left behind due to kernel failures during tests or
reboots while tests are in progress, so make sure that they at least
clean up such mess the next time they run.
Test generic/247, xfs/020 (fsfile) and generic/074 (fstest.$$.n)
are the worst offenders, so just target these to being with.
Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Eric Sandeen [Mon, 29 Sep 2014 02:55:54 +0000 (12:55 +1000)]
xfs/005: sync superblock modification to disk before mount test
This test tries to directly corrupt the CRC field of the primary
superblock by using xfs_io pwrite, but never syncs it to disk,
so it's quite likely that the mount will not see the bad data.
Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Josef Bacik [Mon, 29 Sep 2014 02:55:20 +0000 (12:55 +1000)]
btrfs: use _nocheck for btrfs/011 and btrfs/012
These two tests blow up on the scratch test, but 011 leaves the devices in a
state where the first scratch dev is no longer part of any file system and 012
leaves the scratch dev as an ext4 file system. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Filipe Manana [Mon, 29 Sep 2014 02:54:55 +0000 (12:54 +1000)]
btrfs: add test regarding clearing compression flag/property
Regression test for btrfs where removing the flag FS_COMPR_FL
(chattr -c) from an inode wouldn't clear its compression property.
This was fixed in the following linux kernel patch:
Btrfs: add missing compression property remove in btrfs_ioctl_setflags
Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Disseldorp <ddiss@suse.de> Signed-off-by: Dave Chinner <david@fromorbit.com>