Theodore Ts'o [Fri, 3 Feb 2017 16:25:37 +0000 (11:25 -0500)]
generic/398: update errors to be returned when doing cross renames w/o keys
The bug fix that ultimately landed in the fscrypt tree will return
ENOKEY instead of EPERM when doing a cross rename involving a
directory where the key is not available. So fix up the golden output
for generic/398 accordingly.
Theodore Ts'o [Fri, 3 Feb 2017 20:50:37 +0000 (15:50 -0500)]
generic/388: use the src/godown program instead of xfs_io
The "xfs_io -xc shutdown $MNT" command doesn't work on non-xfs file
systems. So use the equivalent src/godown program instead, which is
how the other tests which use the shutdown command were converted from
xfs-specific tests to generic tests.
Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Amir Goldstein [Fri, 3 Feb 2017 11:05:37 +0000 (13:05 +0200)]
generic/007: cleanup $TEST_DIR/$seq dir
Test generic/007 was failing after running test overlay/007,
because the latter left behind a non empty directory named 007
in test dir and the former failed to mkdir a directory with the
same name.
Cleanup $TEST_DIR/$seq both at end of overlay/007 and beginning of
generic/007 to avoid this collision.
Darrick J. Wong [Sat, 28 Jan 2017 17:38:25 +0000 (09:38 -0800)]
xfs/030: ignore lost rmapbt blocks
When we destroy the AG0 headers, we also lose track of the rmapbt
blocks, which causes xfs_repair to complain about their unconnectedness.
Filter out the error message from the output.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Lakshmipathi.G [Fri, 3 Feb 2017 04:47:16 +0000 (12:47 +0800)]
btrfs: check btrfs-convert with extent and non-extent source
This is used to check the source which contains combination of Ext3
files in non-extent format and Ext4 extent-files. And validate the
file md5sums before and after conversion.
btrfs/012: BTRFS_CONVERT_PROG,E2FSCK_PROG definitions reused from
common/config
Darrick J. Wong [Mon, 23 Jan 2017 18:52:24 +0000 (10:52 -0800)]
mvtest: change "FSQA Test No." when we renumber tests
We have a number of tests (and submitters) who write tests
containing "FSQA Test No." (as opposed to "FS QA Test No."), so
update the mvtest script to change both forms.
Also fix a sed bug that deletes too many group lines.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Darrick J. Wong [Sat, 21 Jan 2017 08:11:21 +0000 (00:11 -0800)]
xfs: fuzz every field of every structure
Previously, our XFS fuzzing efforts were limited to using the xfs_db
blocktrash command to scribble garbage all over a block. This is
pretty easy to discover; it would be far more interesting if we could
fuzz individual fields looking for unhandled corner cases. Since we
now have an online scrub tool, use it to check for our targeted
corruptions prior to the usual steps of writing to the FS, taking it
offline, repairing, and re-checking.
These tests use the new xfs_db 'fuzz' command to test corner case
handling of every field. The 'print' command tells us which fields
are available, and the fuzz command can write zeroes or ones to the
field; set the high, middle, or low bit; add or subtract numbers; or
randomize the field. We loop through all fields and all fuzz verbs to
see if we can trip up the kernel.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Darrick J. Wong [Sat, 21 Jan 2017 08:11:04 +0000 (00:11 -0800)]
populate: discover XFS structure fields and fuzz verbs, and use them to fuzz fields
Create some routines to help us perform targeted fuzzing of individual
fields in various XFS structures. Specifically, we want the caller to
drop the xfs_db iocursor on the victim field; from there, the scripts
should discover all available fields and fuzzing verbs, and try each
fuzz verb on every available field.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Darrick J. Wong [Sat, 21 Jan 2017 08:10:58 +0000 (00:10 -0800)]
populate: cache scratch metadata images
Create a helper function to create a populated FS image and dump the
metadata into a file on the test device, with the purpose of allowing
future (fuzzer) invocations of _populate_fs use the cached metadata to
save time.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Darrick J. Wong [Sat, 21 Jan 2017 08:10:44 +0000 (00:10 -0800)]
populate: fix some silly errors when modifying a fs while fuzzing
There were some silly errors in _scratch_fuzz_modify such that it
wasn't really doing much of anything because of undefined variables.
(Sloppy refactoring when converting xfsfuzz.sh into xfstests.)
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Darrick J. Wong [Sat, 21 Jan 2017 08:10:38 +0000 (00:10 -0800)]
populate: optionally fill the filesystem when populating fs
Be a little more flexible in how much we fill up a pre-populated
filesystem. For the field fuzzing tests, we don't need the extra
space/inode usage and therefore won't want much at all.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Darrick J. Wong [Sat, 21 Jan 2017 08:10:31 +0000 (00:10 -0800)]
populate: add _require_populate_commands to check for tools
Back when I created common/populate, I thought it was sufficient to
_require the tools that the populate functions need in the main
file. This turned out to be a bit sloppy, so move them into a
helper function and call it from everything that uses populate.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Filipe Manana [Thu, 12 Jan 2017 03:13:50 +0000 (03:13 +0000)]
btrfs: incremental send after replacing directory
Test that an incremental send operation works when in both snapshots
there are two directory inodes that have the same number but
different generations and have an entry with the same name that
corresponds to different inodes in each snapshot.
The btrfs issue is fixed by the following patch for the linux kernel:
"Btrfs: incremental send, do not issue invalid rmdir operations"
Signed-off-by: Robbie Ko <robbieko@synology.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Filipe Manana [Thu, 12 Jan 2017 03:13:37 +0000 (03:13 +0000)]
btrfs: incremental send after moving a directory
Test that an incremental send operation works after moving a
directory into a new parent directory, deleting its previous parent
directory and creating a new inode that has the same inode number as
the old parent.
This issue is fixed by the following patch for the linux kernel:
"Btrfs: incremental send, do not delay rename when parent inode is new"
Signed-off-by: Robbie Ko <robbieko@synology.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Filipe Manana [Thu, 12 Jan 2017 03:13:13 +0000 (03:13 +0000)]
btrfs: incremental send after replacing a top level inode
Test that an incremental send operation does not fail when a new
inode replaces an old inode that has the same number but different
generation, and both are direct children of the subvolume/snapshot
root.
This is fixed by the following patch for the linux kernel:
"Btrfs: send, fix failure to rename top level inode due to name
collision"
Signed-off-by: Robbie Ko <robbieko@synology.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Amir Goldstein [Wed, 11 Jan 2017 06:41:12 +0000 (08:41 +0200)]
xfs: test readlink/readdir with malformed inode mode
In addition to testing xfs_repair on inodes with malformed mode,
and fstat of those inodes on a mounted fs, try to also list content
of mock directory and readlink of mock symlink.
Readdir of mock directory triggers XFS assertion on kernel 4.9 with
XFS_DEBUG=y
Amir Goldstein [Mon, 9 Jan 2017 13:30:24 +0000 (15:30 +0200)]
xfs: test fstat with malformed inode mode
In addition to testing xfs_repair on inodes with malformed mode,
also test fstat of those inodes on a mounted fs.
This additional test is quite noisy with dmesg warnings, so
check dmesg has been disabled.
This test fails on kernel 4.9 because a zero size inode is not
identified as malformed dir. A patch has been sent to fix this
("xfs: sanity check directory inode di_size").
Eric Sandeen [Fri, 13 Jan 2017 14:56:15 +0000 (08:56 -0600)]
tools: compare-failures script
This is a simple script to compare failures across runs.
Given files containing stdout from several runs, each of which contains
a Failures: line, it will print a table of all failures for each run.
Test subdir names are abbreviated for compactness, i.e. generic->g.
For 7 results files named test 1 through test 7:
David Sterba [Mon, 16 Jan 2017 15:35:12 +0000 (16:35 +0100)]
common/btrfs: add helper to detect dump-super or btrfs-show-super
The command btrfs-show-super is not supposed to be distributed but
was useful for testing. The same functionality is now present as
'btrfs inspect-internal dump-super', let's detect which one is
available and use it in btrfs/011 that fails with btrfs-progs 4.8.4+
Amir Goldstein [Mon, 16 Jan 2017 12:42:25 +0000 (14:42 +0200)]
overlay: test concurrent copy up
Run 4 process pairs, each competing over copy up of 1K files
in 1 directory. One opponent touches all files in the directory
and the other truncates all files in the directory.
This test does NOT check for concurrent copy up support. It only
fails on unexpected errors of any of the touch/truncate operations.
The test full output should demonstrate the expected results -
for kernel with concurrent copy up support, truncate workers are
not delayed by touch workers. As a result, truncate workers will
finish their work much sooner than a test run without concurrent
copy up support.
David Disseldorp [Thu, 12 Jan 2017 17:18:48 +0000 (18:18 +0100)]
common: remove unused XFSPROGS_VERSION check
This was only used to check for mkfs.xfs -n version=ci support,
which is carried in xfsprogs >= 2.10. _require_xfs_mkfs_ciname() is
now used to explicitly check for the mkfs parameter.
Eryu Guan [Fri, 16 Dec 2016 04:14:14 +0000 (12:14 +0800)]
Revert "generic/38[3-6]: require project quota to be enabled on SCRATCH_DEV"
Commit 23f60ef304d ("generic/38[3-6]: require project quota to be
enabled on SCRATCH_DEV") introduced a regression that leads
_require_projquota, which uses src/feature to call a quotactl,
operate before the filesystem is mounted, and results in tests not
run on XFS and ext4.
Revert the problematic patch first, because don't want to lose
project quota test coverage on XFS and ext4. We can fix the false
failure on ext3/2 later,
Reported-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Roman Pen [Wed, 11 Jan 2017 09:52:39 +0000 (10:52 +0100)]
generic: reproduce ext4 bugs in a shift extents logic
Regression test which targets two nasty ext4 bugs in a logic which
shifts extents:
1) 14d981f468a1 ("ext4: Include forgotten start block on fallocate insert range")
Test tries to insert many blocks at the same offset to reproduce
the following layout on ext4:
block #0 block #1
|ext0 ext1|ext2 ext3 ...|
^
insert of a new block
Because of an incorrect range first block is never reached,
thus ext1 is untouched, resulting to a hole at a wrong offset:
What we got:
block #0 block #1
|ext0 ext1| ext2 ext3 ...|
^
hole at a wrong offset
What we expect:
block #0 block #1
|ext0 ext1|ext2 ext3 ...|
^
hole at a correct offset
2) 2b3864b32403 ("ext4: do not polute the extents cache while shifting extents")
Extents status tree is filled in with outdated offsets while doing
extent shift, that leads to wrong data blocks. That's why md5sum
of a result file is being checked after each block insert.
Amir Goldstein [Mon, 9 Jan 2017 13:39:11 +0000 (15:39 +0200)]
xfs: test handling of invalid inode modes
Set all possible file type values for different types of files
and verify that xfs_repair detects the correct errors.
When setting invalid file type values (e.g. core.mode = 0170644),
all files are expected to have been junked by xfs_repair.
When setting valid file type values to non matching file types,
xfs_repair would either detect wrong format and junk the file, e.g.:
would have junked entry "DATA" in directory PARENT_INO
or detect a ftype mismatch error, e.g.:
would fix ftype mismatch (5/3) in directory/child PARENT_INO/FIFO_INO
If ftype feature is enabled, when setting file type to one of the
special types (i.e. FIFO(1), CHRDEV(2),BLKDEV(6),SOCKET(14)),
xfs_repair is expected to detect ftype mismatch error. Otherwise,
xfs_repair is not expected to detect ftype mismatch error.
Darrick J. Wong [Mon, 9 Jan 2017 20:55:18 +0000 (12:55 -0800)]
xfs/ext4: check negative inode size
Craft a malicious filesystem image with a negative inode size,
then try to trigger a kernel DoS by appending data to the file.
Ideally this should trigger verifier errors instead of hanging.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Darrick J. Wong [Thu, 5 Jan 2017 01:05:08 +0000 (17:05 -0800)]
reflink: make error reporting consistent when simulating EIO
When we're using dm-error to simulate failed devices, we don't really
know if the write or the fdatasync is going to receive the EIO. For
tests that make a single (failed) write attempt and never retry, it's
sufficient to check that the file md5 doesn't change after recovery.
For tests that /do/ retry the write, we should capture the entire output
and just look for the word error instead of enshrining the exact perror
message (filename/function call and everything) in the golden output.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Darrick J. Wong [Mon, 9 Jan 2017 20:53:35 +0000 (12:53 -0800)]
reflink: fix quota tests to work properly
Fix the reflink quota tests to su to the fsgqa user so that we actually
test enforcement of quotas. Seems that XFS enforces user quotas even
if root is writing to a user file, whereas everything else lets root
writes through. Also clean up some of the variable usage and
_require_user.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Darrick J. Wong [Thu, 5 Jan 2017 01:04:55 +0000 (17:04 -0800)]
ocfs2/reflink: fix file block size reporting
Some of the reflink tests try to require a specific filesystem block
size so that they can test file block manipulation functions. That's
straightforward for most filesystems but ocfs2 throws in the additional
twist that data fork block mappings are stored in units of clusters, not
blocks, which causes these reflink tests to fail.
Therefore, introduce a new helper that retrieves the file minimum block
size and adapt the reflink tests to use that instead.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Eric Sandeen [Mon, 9 Jan 2017 16:49:21 +0000 (10:49 -0600)]
xfs/010: explicitly allow corrupted write in xfs_db
xfs/010 wants to write corruption and test how xfs_repair
deals, but when:
xfs: forbid AG btrees with level == 0
is merged to userspace, this new test fails the write verifier
in xfs_db.
Add "-c" to allow the corrupted write, do the corruptions all
in one xfs_db command (so it doesn't have to re-read the
corrupted data on 2nd startup), and filter out the
"Allowing write of corrupted data and bad CRC"
output from the "write -c" command.
Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Brian Foster [Fri, 6 Jan 2017 19:39:30 +0000 (14:39 -0500)]
generic: racing getxattr requests against xattr add/remove
This test reproduces a bug in XFS where a getxattr of an existing
xattr returns failure due to a race with a setxattr that causes
inode attribute fork conversion.
Eryu Guan [Fri, 30 Dec 2016 03:34:19 +0000 (11:34 +0800)]
generic/158,304: filter dedupe error message
Kernel commit 22725ce4e4a0 ("vfs: fix isize/pos/len checks for reflink &
dedupe") added more checks on reflink and dedupe, rejected dedupe past
EOF early and explicitly, and causes generic/158 and generic/304 to fail.
Try dedupe from past EOF
-dedupe: Invalid argument
+XFS_IOC_FILE_EXTENT_SAME: Invalid argument
Try dedupe to past EOF, destination offset beyond EOF
Also there's an xfsprogs patch from Darrick ("xfs_io: prefix dedupe
command error messages consistently") to change all xfs_io dedupe
error message prefixes to "XFS_IOC_FILE_EXTENT_SAME".
So introduce a new _filter_dedupe_error, change all "dedupe" prefix
to XFS_IOC_FILE_EXTENT_SAME, make tests pass with both old/new
kernel & userspace.
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Xiong Zhou [Wed, 4 Jan 2017 08:59:11 +0000 (16:59 +0800)]
overlay: copy up and remove from another namespace
Via unshare, copy up dir from lower dir then remove
them in another unshared namespace.
This would fail before v4.7 kernel with EPERM.
Kernel commit 3fe6e52f
ovl: override creds with the ones from the superblock mounter
fixed this issue, with this reproducer provided. Original
reproducer was written by commit author:
Antonio Murdaca <amurdaca@redhat.com>
Amir Goldstein [Wed, 21 Dec 2016 13:50:21 +0000 (15:50 +0200)]
generic: test correct d_type values
Verify correct d_type values of dir entries.
This test does NOT require that file system support the filetype
feature. It verifies that either all file types are reported as
DT_UNKNOWN or that all file types are reported correctly.
For fs for which we know how to test the filetype feature (xfs|ext*)
verify getting DT_UNKNOWN IFF filetype feature is disabled.
Special dir entries . and .. MAY be reported as DT_UNKNOWN IF
filetype feature is disabled (ext4), but MAY also be reported as
DT_DIR in this case (xfs).
Theodore Ts'o [Thu, 22 Dec 2016 19:53:46 +0000 (14:53 -0500)]
overlay: stress test changes to top and bottom layers simultaneously
Introduce a test which runs fsstress on the top and bottom overlayfs
directories simultaneously to find potential races that plagued
wrapfs derived file systems.
[eguan: add copyright info and fix minor code style issue]
Eric Sandeen [Sat, 24 Dec 2016 10:07:45 +0000 (18:07 +0800)]
generic: test GETNEXTQUOTA near INT_MAX
XFS kernel code had a bug where GETNEXTQUOTA-type
quotactls requesting an ID near UINT_MAX could overflow
and return 0 as the "next" active ID.
This test checks that by creating an active quota near
UINT_MAX, then asking for the next one after it.
The proper answer is ENOENT, but if we wrap we'll return
ID 0.
This also changes test-nextquota.c so that it checks
both GETNEXTQUOTA and XGETNEXTQUOTA even if one fails;
it stores the failure conditions and returns 1 if either
of them fails.
Eric Biggers [Thu, 15 Dec 2016 20:26:24 +0000 (12:26 -0800)]
generic: test enforcement of one encryption policy per tree
Add an xfstest which verifies that the filesystem forbids operations
that would violate the constraint that all files in an encrypted
directory tree use the same encryption policy.
Eric Biggers [Thu, 15 Dec 2016 20:26:20 +0000 (12:26 -0800)]
encrypt: add utilities for testing filesystem encryption
Add utility functions for testing filesystem-level encryption via
the common API currently supported by ext4 and f2fs, in development
for ubifs and planned for xfs. Setting and getting encryption
policies will use new commands being added to xfs_io, while adding
and removing encryption keys will use keyctl.
Eryu Guan [Sun, 4 Dec 2016 16:15:08 +0000 (00:15 +0800)]
fstests: teach _scratch_mkfs to handle mkfs option conflicts
Currently in _scratch_mkfs only xfs and ext4 could handle the mkfs
failure caused by conflicts between $MKFS_OPTIONS and mkfs options
specified by tests, because of _scratch_mkfs_xfs and
_scratch_mkfs_ext4. This is a very useful functionality that allows
tests to specify mkfs options safely and to test specific fs
configurations, without worrying about mkfs failures caused by these
options.
Now teach _scratch_mkfs to handle such mkfs option conflicts for
other filesystems too, i.e. mkfs again only with mkfs options
specified by tests. Also add the ability to filter unnecessary
messages from mkfs stderr.
Also update some btrfs tests to throw away _scratch_mkfs stdout,
because previously _scratch_mkfs did this for btrfs.
Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Amir Goldstein [Tue, 13 Dec 2016 05:12:37 +0000 (07:12 +0200)]
overlay: test hardlink breakage on copy up
Introduce a new test to demonstrate a known issue with overlayfs:
- file A and B are hardlinked in lower
- modify A to trigger copy up
- file A is no longer a hardlink of file B
Eric Biggers [Tue, 13 Dec 2016 06:57:01 +0000 (22:57 -0800)]
generic/062: don't assume same readdir order after re-creating directory
generic/062 uses getfattr to dump xattrs for a directory tree, then
deletes and recreates that directory tree, then dumps the xattrs
again and compares the dump to the original. This was failing when
run on ext4 with encryption enabled because getfattr's output is in
readdir order, but ext4 encryption by design chooses unpredictable
encrypted filenames for each new directory, causing the readdir
order to change after backup and restore. It is not really a valid
assumption that the readdir order will always be the same, so update
the test to sort the filenames, removing this assumption.
Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Amir Goldstein [Tue, 13 Dec 2016 06:18:29 +0000 (08:18 +0200)]
overlay: test unstable inode number
Introduce a new test to demonstrate a known issue with overlayfs:
- stat file A shows inode number X
- modify A to trigger copy up
- stat file A shows inode number Y != X
Also test if d_ino of readdir entries changes after copy up.
There is a POC patch by Miklos Szeredi that fixes this issue.
Not dealing with hardlinks here, because there is more to test
then stable inode number.
Hardlinks will get a test of their own.
Wang Xiaoguang [Wed, 2 Nov 2016 04:07:27 +0000 (12:07 +0800)]
generic: make 17[1-4] work well when btrfs compression is enabled
When enabling btrfs compression, original codes can not fill fs
correctly, here we introduce _fill_fs() in common/rc, which'll keep
creating and writing files until enospc error occurs. Note _fill_fs
is copied from tests/generic/256, but with some minor modifications.
Darrick J. Wong [Sun, 11 Dec 2016 21:53:22 +0000 (13:53 -0800)]
reflink: don't test disjoint block sharing sets
Unlike xfs/btrfs which store refcounting information as part of the
space metadata, ocfs2 implements block sharing (reflink) by creating
refcount btrees that are shared between subsets of files. Effectively,
this means that a ocfs2 can have multiple disjoint sets of files that
share blocks, which also means that blocks cannot be reflinked between
two disjoint refcounted-file-sets. generic/119 tests the ability to do
this, so we cannot run it for ocfs2. Create a _require helper to check
for this.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Amir Goldstein [Thu, 8 Dec 2016 10:52:20 +0000 (12:52 +0200)]
common: implement _require_xfs_io_command "open"
-c "open $f" is broken in xfs_io <= 4.8. Using it results
in an endless loop and xfs_io exists with error EMFILE.
A fix for that bug makes "open" a 'one shot' command.
Along with this fix, a new -C flag was introduced to explicitly
request to execute a one shot command.
Check for -C flag support as an indication that -c "open $f"
is not broken.
Qu Wenruo [Fri, 9 Dec 2016 01:19:59 +0000 (09:19 +0800)]
btrfs: Use _require_btrfs_qgroup_report to replace open code
Introduce new _require_btrfs_qgroup_report function, which will
check the accessibility to "btrfs check --qgroup-report", then set a
global flag to info _check_scratch_fs() to do extra qgroup check.
Qu Wenruo [Thu, 8 Dec 2016 08:12:12 +0000 (16:12 +0800)]
common/btrfs: rename and enhance _require_btrfs to _require_btrfs_command
Rename _require_btrfs() to _require_btrfs_command() to avoid
confusion, as all other _require_btrfs_* has a quite clear suffix,
like _require_btrfs_mkfs_feature() or _require_btrfs_fs_feature().
Also enhance _require_btrfs_command() to accept 2nd level commands
or options.
Options will be determined by the first "-" char. This is quite
useful for case like "btrfs inspect-internal dump-tree" and "btrfs
check --qgroup-report".
[eguan: make local vars in _require_btrfs_command "local"]
Ross Zwisler [Wed, 7 Dec 2016 04:04:01 +0000 (21:04 -0700)]
build: fix build warnings and notify_others() bug
This patch addresses the following build warnings:
fsx.c: In function 'do_punch_hole':
fsx.c:940:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (!quiet && testcalls > simulatedopcount)
^~
fsx.c:942:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
log4(OP_PUNCH_HOLE, offset, length, FL_SKIPPED);
^~~~
fsx.c:947:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (!quiet && testcalls > simulatedopcount)
^~
fsx.c:949:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
log4(OP_PUNCH_HOLE, offset, length, FL_SKIPPED);
^~~~
fsx.c: In function 'do_zero_range':
fsx.c:995:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (!quiet && testcalls > simulatedopcount)
^~
fsx.c:997:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
log4(OP_ZERO_RANGE, offset, length, FL_SKIPPED |
^~~~
[CC] growfiles
growfiles.c: In function 'notify_others':
growfiles.c:1458:6: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if ( Forker_pids[ind] != Pid )
^~
growfiles.c:1462:10: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
kill(Forker_pids[ind], SIGUSR2);
^~~~
The warnings in fsx.c were just spacing issues of the form:
if (length == 0) {
if (!quiet && testcalls > simulatedopcount)
prt("skipping zero length punch hole\n");
log4(OP_PUNCH_HOLE, offset, length, FL_SKIPPED);
return;
}
Where the log4() call just needs to be unindented. log4() calls
elsewhere in that same file are not protected with any sort of
'quiet' check, and commonly follow prt() calls which are. See
doread(), domapread(), etc.
The warning from growfiles.c was actually a bug. notify_others() is
looping through the Forker_pids[] array and sending SIGUSR2 to all
other processes. However, with the current logic it only *logs* the
kill for other processes, and kills all other processes plus the
Forker_pids[] entry that matches 'Pid'.
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Cc: Dave Chinner <david@fromorbit.com> Cc: Lukas Czerner <lczerner@redhat.com> Cc: Allison Henderson <achender@vnet.ibm.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Nathan Scott <nathans@sgi.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Omar Sandoval [Tue, 6 Dec 2016 01:01:28 +0000 (17:01 -0800)]
generic/35[67]: disable swapfile tests on Btrfs
Btrfs doesn't support swapfiles (yet?), so generic/356 fails
erroneously, and generic/357 only passes by accident. Let's add a
_require_scratch_swapfile helper and add it to these tests.
Signed-off-by: Omar Sandoval <osandov@fb.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Eric Biggers [Wed, 30 Nov 2016 22:31:42 +0000 (14:31 -0800)]
build: allow building with latest xfslibs on 32-bit Linux
The next version of xfslibs will require that its users enable
transparent largefile support. This broke building xfstests on
32-bit Linux because _FILE_OFFSET_BITS=64 was not getting defined
when testing for xfs headers. Fix this by defining
_FILE_OFFSET_BITS=64 when doing configure checks for the xfs
headers.
It was not necessary to define _FILE_OFFSET_BITS=64 for the actual
build because it's already done, in builddefs.in.
The problem could also be solved by adding AC_SYS_LARGEFILE to
configure.ac. It's debatable, but I chose not to do that because it
might give the impression that it affects the actual compilation of
the test programs and not just the configure checks. (Since not all
.c files include config.h first, a _FILE_OFFSET_BITS definition in
config.h wouldn't always take effect.)
Dave Chinner [Tue, 29 Nov 2016 21:32:32 +0000 (08:32 +1100)]
common: split XFS functions from common/rc
common/rc has become a dumping ground for common functions that
don't have a specific topic file. It's getting huge and difficiult
to manage, and people are duplicating functionality because they
can't easily find existing functions in the mess.
Let's start to make it a little easier to manage by splitting out
the XFS specific functions into common/xfs and source that from
common/rc automatically. Other filesytems can follow suit in
future, leaving us with only generic functionality in common/rc.
Signed-Off-By: Dave Chinner <dchinner@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
Dave Chinner [Wed, 30 Nov 2016 04:59:08 +0000 (15:59 +1100)]
generic/095: add iomap_dio_rw() to the dmesg filter
Oops, we did it again - we moved the XFS dio code warning to a new
function with the iomap direct IO rework. Update the filter to pick
up the new warning location.
Signed-Off-By: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <eguan@redhat.com>
Dave Chinner [Tue, 29 Nov 2016 02:48:09 +0000 (13:48 +1100)]
check: add brief result summaries
When running multiple sections and hundreds of tests in each config
section, it's hard to see what failed from the summary output
because of the hundreds of tests listed in the "tests run" and
"tests not run" output. Add a "-b" option for brief result summaries
that only output the tests that failed and the summary count of
tests failed.