aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2018-04-18generic: test using fs-verity and fscrypt simultaneouslyHEADmasterEric Biggers3-0/+112
Signed-off-by: Eric Biggers <ebiggers@google.com>
2018-04-18generic: test fs-verity elide and patch extensionsEric Biggers3-0/+288
Signed-off-by: Eric Biggers <ebiggers@google.com>
2018-04-18generic: test that fs-verity is using the correct measurement valuesEric Biggers3-0/+86
Signed-off-by: Eric Biggers <ebiggers@google.com>
2018-04-18generic: test corrupting fs-verity filesEric Biggers3-0/+242
Signed-off-by: Eric Biggers <ebiggers@google.com>
2018-04-18generic: test fs-verity footer validationEric Biggers3-0/+440
Signed-off-by: Eric Biggers <ebiggers@google.com>
2018-04-18generic: test fs-verity access controlEric Biggers3-0/+79
Signed-off-by: Eric Biggers <ebiggers@google.com>
2018-04-18generic: test general semantics of fs-verity filesEric Biggers3-0/+424
Signed-off-by: Eric Biggers <ebiggers@google.com>
2018-04-18verity: add common functions for testing fs-verityEric Biggers2-0/+202
Add common functions for testing fs-verity, i.e. filesystem-level integrity/authenticity protection of readonly files. Currently fs-verity is only implemented for f2fs, but ext4 and other filesystems may support this same API in the future, and the same tests will be runnable on those other filesystems too. Running the fs-verity tests will require the 'fsverity' and 'fsveritysetup' utility programs, which are not part of xfstests and need to be installed separately. Signed-off-by: Eric Biggers <ebiggers@google.com>
2018-04-14xfs/187: fix ftype brokennessDarrick J. Wong1-2/+9
This test requires XFS_SB_VERSION_MOREBITSBIT to be zero. ftype (which is now enabled by default) causes this to be set, so detect it in mkfs and disable it. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-04-13generic: test for fsync after fallocateFilipe Manana3-0/+138
Test that fsync operations preserve extents allocated with fallocate(2) that are placed beyond a file's size. This test is motivated by a bug found in btrfs where unwritten extents beyond the inode's i_size were not preserved after a fsync and power failure. The btrfs bug is fixed by the following patch for the linux kernel: "Btrfs: fix loss of prealloc extents past i_size after fsync log replay" Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-04-12common/config: support f2fs-tools v1.9 and laterEric Biggers1-6/+11
Pass the -f option to mkfs.f2fs when it appears to support it. This is required by f2fs-tools v1.9 and later in order to format the filesystem even when an existing filesystem is detected. But earlier versions did not accept this option. mkfs.f2fs doesn't yet have an option to print its version number. So, to detect a new enough version we grep for -f in the help output. This also works for mkfs.btrfs, so we switch that over to the same method rather than grepping for "force overwrite" in the binary. Signed-off-by: Eric Biggers <ebiggers@google.com> Acked-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-04-12common/rc: fix up variable namingEric Biggers3-80/+80
Remove the leading underscore from local variable names, and add a leading underscore to $err_msg to reflect its status as a global variable shared by 'check' and 'common/report'. Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-04-12common/rc: add missing 'local' keywordsEric Biggers1-145/+154
Many helper functions in xfstests are unnecessarily declaring variables without the 'local' keyword, which pollutes the global namespace and can collide with variables in tests. Fix this for everything in common/rc that I could find. In _math(), just eliminate $result by removing the check for nonempty $BC, which is redundant with _require_math() which the tests do. Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-04-08generic: Check the fs after each FUA writesQu Wenruo4-0/+167
Basic test case which triggers fsstress with dm-log-writes, and then check the fs after each FUA writes. With needed infrastructure and special handlers for journal based fs. [Eryu: cap $nr_cpu to 8 to avoid wasting time on hosts with many cpus] Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-04-08log-writes: Add support for METADATA flagQu Wenruo2-5/+7
Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-04-08log-writes: Add support to output human readable flagsQu Wenruo1-7/+63
Also change the flag numeric output to hex. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-04-08common/rc: improve checks for YP/NISBenjamin Coddington1-1/+2
At the 2018 spring NFS BAT, we have a number of systems that return a valid string from `domainaname`, but don't have the ypcat binary. If we don't have the yp-tools package installed, we're not going to be able to use ypcat, so check for it and bail out. Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-29overlay: test decoding overlay file handles with warm/cold dentry cacheAmir Goldstein3-0/+147
When opening a non-dir by file handle and the decoded inode/dentry are not in cache, the resulting dentry is "disconnected" (i.e. unknown path). This is a common case that is already covered by previous tests. This test covers the case of decoding an overlay file handle, while a disconnected dentry is still in cache. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-29open_by_handle: add -s option to sleep and keep files open by handleAmir Goldstein1-8/+22
This feature is needed for tests that need to open file by handle and then perform operations while that file is open. This will be used by an overlay test to keep disconnected dentries in dcache. Usage: open_by_handle -s <test_dir> On success, the program will run until it gets a terminating signal. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-29open_by_handle: add -n option to suppress drop cachesAmir Goldstein1-16/+25
By default, open_by_handle drops inode and page caches before trying to open by file handles. Add an option to suppress drop caches for testing open by handle with warm caches. Usage: open_by_handle -n <test_dir> [N] Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-29open_by_handle: make -h (help) a valid optionAmir Goldstein1-3/+3
All this does is suppress the "illegal value" message. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-29xfs/278: find sfdir inode field prefixDarrick J. Wong1-8/+30
Use the xfs set/get metadata field helpers to detect the correct sfdir field name prefix on v4-v5 filesystems. This enables us to test inode link count corrections on a (deliberately) disconnected directory. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-28xfs: test agfl reset on bad list wrappingDarrick J. Wong4-4/+298
From the kernel patch that this test examines ("xfs: detect agfl count corruption and reset agfl"): "The struct xfs_agfl v5 header was originally introduced with unexpected padding that caused the AGFL to operate with one less slot than intended. The header has since been packed, but the fix left an incompatibility for users who upgrade from an old kernel with the unpacked header to a newer kernel with the packed header while the AGFL happens to wrap around the end. The newer kernel recognizes one extra slot at the physical end of the AGFL that the previous kernel did not. The new kernel will eventually attempt to allocate a block from that slot, which contains invalid data, and cause a crash. "This condition can be detected by comparing the active range of the AGFL to the count. While this detects a padding mismatch, it can also trigger false positives for unrelated flcount corruption. Since we cannot distinguish a size mismatch due to padding from unrelated corruption, we can't trust the AGFL enough to simply repopulate the empty slot. "Instead, avoid unnecessarily complex detection logic and and use a solution that can handle any form of flcount corruption that slips through read verifiers: distrust the entire AGFL and reset it to an empty state. Any valid blocks within the AGFL are intentionally leaked. This requires xfs_repair to rectify (which was already necessary based on the state the AGFL was found in). The reset mitigates the side effect of the padding mismatch problem from a filesystem crash to a free space accounting inconsistency." This test exercises the reset code by mutating a fresh filesystem to contain an agfl with various list configurations of correctly wrapped, incorrectly wrapped, not wrapped, and actually corrupt free lists; then checks the success of the reset operation by fragmenting the free space btrees to exercise the agfl. Kernels without this reset fix will shut down the filesystem with corruption errors. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-25overlay/05[45]: Document the fix commitAmir Goldstein2-0/+6
This fix was merged for v4.16-rc5. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-23generic/478: fix potential test blockingXiong Zhou1-6/+10
Reduce semtimedop timeout to 5s, 15s is too long if something get tangled up. Add retry counting to getlk routine, infinite loop is dangerous. If something goes wrong unexpextedly, test is blocked and wasting time. Signed-off-by: Xiong Zhou <xzhou@redhat.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-23common/xfs: fix various problems with _supports_xfs_scrubDarrick J. Wong1-2/+6
The _supports_xfs_scrub helper is called with a mountpoint (a working mountpoint is required for scrub) and a block device (used to detect norecovery mounts). If either of these conditions aren't satisfied we should return failure status to the caller, not unilaterally decide to bail out of the test. In particular, the -b test doesn't work if the fs has already shutdown on us. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-23common/xfs: don't call xfs_scrub on a block deviceDarrick J. Wong1-1/+1
xfs_scrub takes an xfs mountpoint as its argument, not a block device. Therefore, fix _check_xfs_filesystem to call it correctly. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-23build: fix <ndbm.h> detection in AC_PACKAGE_WANT_GDBMJeff Mahoney2-20/+3
SUSE systems export the NDBM interface via /usr/include/ndbm.h This means that dbtest wasn't built on SUSE systems until commit 2353022 (build: update AC_PACKAGE_WANT_GDBM() and src/dbtest.c to build). That change was incompatible with older SLES releases due to <ndbm.h> and <gdbm.h> both defining the datum type, resulting in build failures. Nothing has ever set HAVE_GDBM_H or checked for the <gdbm.h> header prior to the above commit, and it's not required on SUSE systems either, so just remove that entirely. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-23build: clean up AC_PACKAGE_WANT_GDBMJeff Mahoney1-32/+55
The AC_PACKAGE_WANT_GDBM macro is not easily read. It's not doing anything particularly complex other than working through a set of alternatives for headers and libraries. This patch cleans it up to be more readable. We also only attempt to check in libgdbm_compat if the checks in libgdbm fail. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-23build: AC_PACKAGE_WANT_GDBM, fall back to compat if libgdbm detection failsJeff Mahoney1-10/+9
We currently check if libgdbm_compat contains the required symbols even if libgdbm does. Let's fall back only when necessary (which is pretty much always anyway). Signed-off-by: Jeff Mahoney <jeffm@suse.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-23build: remove dead AC_PACKAGE_WANT_NDBM macroJeff Mahoney1-20/+0
Commit fb05a918085 build: remove IRIX-specific build logic) removed the tests used on IRIX but missed AC_PACKAGE_WANT_NDBM. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-16generic/015: Issue sync after deleting the fillup fileNikolay Borisov1-0/+2
This test fails on btrfs due to the presence of delayed processing of file deletes if the file is smaller than 32mb. Initially commit 97575acd7495b412435d06229a6d94ed9a814ada tried to fix a similar failure by bumping the size of the filesystem. However that change had a knock-on effect in that the scratch filesystem created is larger than 100mb and thus not created in mixed mode. This in turn causes the fs to have only 20mb for file data (rest is taken by DUP metadata). Naturally, this leads to file freeing taking up to "transaction commit interval" (default 30 s) time to properly account the freed space. Not standards define when unlink operations should be accounted so btrfs is well within its right to be implemented in that way. So to avoid this edge case just issue a sync before taking the 2nd free space reading. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-16overlay: Absolute redirect should be followed even if ancestor is opaqueVivek Goyal3-0/+107
Typically, when following absolute redirect, if an opauqe dentry is found, lookup in further lower directories is stopped. But if a child dentry has another absolute redirect, then lookup in further lower layers should continue. Say, following is example setup. upper: /redirect (redirect=/a/b/c) lower1: /a/[b]/c ([b] is opaque) (c has absolute redirect=/a/b/d/) lower0: /a/b/d/foo "redirect" directory in upper should merge with lower1:/a/b/c/ and lower0:/a/b/d/, despite lower1:/a/b/ being opaque. This example and kernel fix has come from Amir Goldstein. I am just putting a test for it to make sure its not broken down the line. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-16generic: test on creating new file after log replayLiu Bo3-0/+79
The regression is introduced to btrfs in linux v4.4 and it refuses to create new files after log replay by returning -EEXIST. Although the problem is on btrfs only, there is no btrfs stuff in terms of test, so this makes it generic. The kernel fix is Btrfs: fix unexpected -EEXIST when creating new inode [Eryu: add _require_metadata_journaling rule and 'log' 'metadata' group] Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-08btrfs/146: make sure hit all stripes in the case of compressionLu Fengqi1-3/+6
In the case of compression, each 128K input data chunk will be compressed to 4K (because of the characters written are duplicate). Therefore we have to write (128K * 16) to make sure every stripe can be hit. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-07btrfs/004: increase the buffer size of logical-resolve to the maximum value 64KLu Fengqi1-1/+1
Because of commit e76e13ce8c0b ("fsstress: implement the clonerange/deduperange ioctls"), dedupe makes the number of references to the same extent item increase so much that the default 4K buffer of logical-resolve is no longer sufficient. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-04generic: test fsync new file after removing hard linkFilipe Manana3-0/+86
Test that if we have a file with two hard links in the same parent directory, then remove of the links, create a new file in the same parent directory and with the name of the link removed, fsync the new file and have a power loss, mounting the filesystem succeeds. This test is motivated by a bug found in btrfs, which is fixed by the linux kernel patch titled: "Btrfs: fix log replay failure after unlink and link combination" Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-04generic: add test for fsync after renaming and linking special fileFilipe Manana3-0/+115
Test that when a fsync journal/log exists, if we rename a special file (fifo, symbolic link or device), create a hard link for it with its old name and then commit the journal/log, if a power loss happens the filesystem will not fail to replay the journal/log when it is mounted the next time. This test is motivated by a bug found in btrfs, which is fixed by the following patch for the linux kernel: "Btrfs: fix log replay failure after linking special file and fsync" Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-01overlay: correct scratch dirs checkzhangyi (F)14-16/+122
Tests that use _overlay_scratch_mount_dirs instead of _scratch_mount should use _require_scratch_nocheck instead of _require_scratch because these tests are either mounting with multiple lower dirs or mounting with non-default lower/upper/work dir, so _check_overlay_scratch_fs won't handle these cases correctly. So we introduce _overlay_check_scratch_dirs helper and should call this helper with the correct dir arguments for these non-default cases. This patch modify these tests to optionally call _overlay_check_scratch_dirs at the end of the test or after _scratch_umount to mount base filesystem only and run the checker. Signed-off-by: zhangyi (F) <yi.zhang@huawei.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-01overlay: skip check for tests finished with corrupt filesystemzhangyi (F)3-3/+3
No post-test check of the overlay dirs is required if case leaves corrupt filesystem after test. We shoud use _require_scratch_nocheck() instead of _require_scratch() in these cases. Signed-off-by: zhangyi (F) <yi.zhang@huawei.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-01overlay/003: fix fs check failurezhangyi (F)1-1/+0
_check_overlay_scratch_fs() will check lowerdir of overlay filesystem, this case remove this directory after test will lead to check failure, and it is not really necessary to remove this directory, so keep this directory. Signed-off-by: zhangyi (F) <yi.zhang@huawei.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-01overlay: hook filesystem check helperzhangyi (F)4-4/+127
Hook filesystem check helper to _check_test_fs and _check_scratch_fs for checking consistency of underlying dirs of overlay filesystem. These helpers works only if fsck.overlay exists. This patch introduce OVERLAY_FSCK_OPTIONS use for check overlayfs like OVERLAY_MOUNT_OPTIONS, and also introduce a mount point check helper in common/rc to detect a dir is a mount point or not. [ _check_test_fs/_check_scratch_fs part picked from Amir's patch, thanks ] Signed-off-by: zhangyi (F) <yi.zhang@huawei.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-03-01common/rc: improve dev mounted check helperzhangyi (F)2-20/+11
There is a problem of missing fstype check in _is_mounted() helper, it will return the mountpoint if only the device arguments matches. For example: Base mounted filesystem: /dev/sda2 on /boot type ext4 (rw,relatime,data=ordered) FSTYPE=xfs mountpoint=`_is_mounted /dev/sda1` echo "$mountpoint" Output: /boot This patch rename _is_mounted to _is_dev_mounted because it check the given device only (not mount dir), and add an optional "fstype" parameter, let user specify file system type instead of default FSTYPE. Finally, use findmnt instead of mount to avoid complex processing of mount info and fix this problem simply. Signed-off-by: zhangyi (F) <yi.zhang@huawei.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-02-24fsstress: avoid infinite loops in clonerange_fDarrick J. Wong1-1/+3
Evidently ceph will report a 4M blocksize, which trips clonerange_f's clumsy attempt to avoid reflinking an extent on top of itself. The original code assumed that "pick a random destination up to 1MB past the end of the file" would suffice, but that clearly won't with a 4M blocksize. Instead, we'll change it to 1024*blksize. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Tested-by: Luis Henriques <lhenriques@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-23generic/47[23]: remove from auto/quick groupsDave Chinner1-2/+2
generic/472 is for changes that are not upstream and seem dead in the water at the moment, so remove this test from the auto and quick groups until it's been resolved upstream and the changes merged. generic/473 really doesn't seme useful. FIEMAP is a debugging interface, xfs_io is a debugging tool and so trying to make every filesytem report exactly the same thing for a ranged query just strikes me as the wrong thing to be doing. This fails on XFS, and there's no apparent resolution to that in sight, so remove the test from the auto and quick, too. Signed-Off-By: Dave Chinner <dchinner@redhat.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-23common/xfs: Initialise OPTIND for getopts callsDave Chinner4-0/+4
According to the bash man page: OPTIND is initialized to 1 each time the shell or a shell script is invoked. This doesn't appear to be true - in tests scripts with no other getopts calls, I'm seeing the getopts loop in _xfs_check to fail to parse input parameters correctly. Tracing shows the parameters are being passed to _xfs_check correctly, but on occassion getopts simply doesn't see them. Hence when running tests with both external log and real time devices, tests are failing at random because xfs_check is mis-parsing the parameters passed to it and not configuring the external log correctly: _check_xfs_filesystem: filesystem on /dev/sdg is inconsistent (c) *** xfs_check output *** aborting - no external log specified for FS with an external log *** end xfs_check output Fix this by ensuring OPTIND is correctly initialised before using getopts. Do it for all places that call getopts that don't already set OPTIND=1 before starting their parsing loop. Signed-Off-By: Dave Chinner <dchinner@redhat.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-22common/rc: Fix fcollapse require code to work with 64k block sizeChandan Rajendra1-2/+4
For 64k block size, the require code fails because the block range [4k, 12k] would cause the fcollapse syscall to return -EINVAL. Hence the tests using them are not executed. This commit fixes the issue by calculating file offset ranges based on the block size of the underlying filesystem. Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-22fsx: Fix -P errorsAndreas Gruenbacher1-16/+15
When -P is used, report the correct *.fsxgood filename in report_failure and fix the default *.fsxops filename. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-22fstests: _fail test by default when _scratch_mount failsEryu Guan109-192/+184
Previously _scratch_mount didn't check the mount status and most tests continue to run even if the mount failed (unless test checks for the mount status explicitly). This would result in running tests on the underlying filesystem (usually rootfs) and implicit test failures, and such failures can be annoying and are usually hard to debug. Now _fail test by default if _scratch_mount failed and introduce _try_scratch_mount for tests that need to check mount results themselves. Suggested-by: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-22generic/25[02]: increase filesystem sizeDave Chinner2-5/+6
On reflink+rmapbt XFs filesystems there isn't enough free space to run this test on the 64MB filesystem image created. It notruns with a curious error message - needs at least 0GB free: generic/250 [10:01:57] [10:01:58] [not run] generic/250 -- This test requires at least 0GB free on /mnt/scratch to run Fix this by increasing the size of the base filesystem image. 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>
2018-02-20btrfs/150: add _scratch_dev_pool_get/put to run the test as expectedMisono, Tomohiro1-0/+2
btrfs/150 uses RAID1 profile and make SCRATCH_DEV fail for test. However, if SCRATCH_DEV_POOL consists more than two devices, SCRATCH_DEV may not be used for RAID1 pair and the tests may not run as expected. Fix this by add _scratch_dev_pool_get/put like other tests (141, 143 etc.) do. Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-16xfs/015: enlarge the initial fs sizeEryu Guan1-3/+3
Kernel commit f59cf5c29919 ("xfs: remove "no-allocation" reservations for file creations") is known to cause earlier ENOSPC conditions, and xfs/015 is affected in the way that no new file/dir can be created in a newly created 16M XFS with both reflink and rmapbt enabled, thus xfs/015 fails due to the missing test dirs. So enlarge the initial fs size to 32M that we're able to create new dir/file before growing the filesystem size. Note that we doubled the fs initial size, we need to double the required space too. Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-16generic: add OFD lock testsXiong Zhou7-1/+800
Test OFD locks. Use fcntl F_OFD_SETLK/F_OFD_GETLK, to verify we are being given correct advices through getlk by kernel. The basic idea is one setlk routine setting locks via fcntl *_SETLK, followed by operations like clone, dup then close fd; another routine getlk getting locks via fcntl *_GETLK. Firstly in setlk routine process P0, place a lock L0 on an opened testfile, then do clone or dup and close relative fd. In getlk process P2, do fcntl *_GETLK with lock L1 after get notified by setlk routine. In the end, getlk routine check the returned struct flock.l_type to see if the lock mechanism works fine. Test combainations of: - shared or exclusive lock - these locks are conflicting or not - one OFD lock and one POSIX lock - that open testfile RDONLY or RDWR - clone with CLONE_FILES or not - dup and close newfd [eguan: made some minor non-functional changes] Signed-off-by: Xiong Zhou <xzhou@redhat.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-09xfs: rmapbt swapext block reservation overrun testBrian Foster3-0/+109
The XFS rmapbt extent swap mechanism performs an extent by extent swap to ensure the rmapbt is rectified with the appropriate extent owner information after the operation. This implementation suffers from a corner case that requires extra reservation if the swap operation results in bouncing one of the associated inodes between extent and btree formats. When this corner case occurs, it results in a transaction block reservation overrun and possible corruption of the free space accounting. This regression test provides coverage for this corner case. It creates two files with a large enough extent count to require btree format, regardless of inode size, and performs a sequence of extent swaps between them with a decreasing extent count until all extents are removed from the file(s). This ensures that one of the swaps covers the btree <-> extent fork format boundary case. This test reproduces fs corruption on rmapbt enabled filesystems running on kernels without the associated extent swap fix. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-09xfs: regression tests for reflink quota bugsDarrick J. Wong7-0/+339
Add three tests to look for quota bugs in xfs reflink. The first test looks for problems when we have speculative cow reservations in memory, we chown the file, but the reservations don't move to the new owner. The second test checks that we remembered to dqattach the inodes before performing reflink operations. The third is a stress test for reflink quota handling near enospc and helped us to find a directio cow write corruption bug when free space is fragmented. 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>
2018-02-09xfs/348: dir->symlink corruption must not be allowedDarrick J. Wong1-1/+1
A directory corrupted into a symlink is caught by the local format ifork verifiers, and previously this test failed to catch such kernel bug, so fix the test. Note that the local format ifork verifiers were introduced by commit 0795e004fd4f ("xfs: create structure verifier function for short form symlinks"), and didn't get wired up until commit 9cfb9b47479e ("xfs: provide a centralized method for verifying inline fork data"). 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>
2018-02-08xfs_scrub: remove -y parameterDarrick J. Wong2-3/+3
Remove the -y parameter from scrub runs since we're removing that option from xfs_scrub. 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>
2018-02-08overlay: renumber tests after mergeEryu Guan7-9/+9
Tests were merged with high seq numbers to avoid conflicts with other tests. Now renumber them to contiguous numbers, as all other tests have been merged correctly. This is easier to do than assigning the final seq numbers at commit time. Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-08overlay: add fsck.overlay impure xattr testzhangyi (F)3-0/+148
Add fsck.overlay test case to test it how to deal with impure xattr in underlying directories of overlayfs. Signed-off-by: zhangyi (F) <yi.zhang@huawei.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-08overlay: add fsck.overlay redirect directory testzhangyi (F)3-0/+278
Add fsck.overlay test case to test it how to deal with invalid/valid/ duplicate redirect xattr in underlying directories of overlayfs. Signed-off-by: zhangyi (F) <yi.zhang@huawei.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-08overlay: add fsck.overlay whiteout testzhangyi (F)3-0/+241
Add fsck.overlay test case to test it how to deal with orphan/valid whiteouts in underlying directories of overlayfs. Signed-off-by: zhangyi (F) <yi.zhang@huawei.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-08overlay: define common overlay xattr keyszhangyi (F)1-0/+8
Define common overlay xattr keys from Linux kernel for ovl tests use. Signed-off-by: zhangyi (F) <yi.zhang@huawei.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-08overlay: add filesystem check helperzhangyi (F)2-0/+15
Add filesystem check helper for the upcoming fsck.overlay utility. This helper invoke fsck.overlay to check and optionally repair underlying directories of overlay filesystem. Signed-off-by: zhangyi (F) <yi.zhang@huawei.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-05generic/270: Check for scratch mount successAndreas Gruenbacher1-1/+1
We don't want to fill up the scratch mount point if the scratch mount fails. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-05check: Fix exit statusAndreas Gruenbacher1-3/+3
Exit with status 1 if there were any failures: using the number of failed tests as the exit status makes no sense and can easily overwrap. In addition, clean up a few minor things. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-03overlay: test overlay file handle of dir with ancestor under lower redirectAmir Goldstein3-0/+181
Overlayfs with nfs_export enabled, indexes all directories on copy up. Directory index is requires for decoding lower directory file handles in case ancestors have been renamed. When enabling nfs_export on an overlay that has merge dirs with lower layer redirects, the possibility of ancestor rename requires special handling when encoding lower directory file handles from layer > 1. - Check decode of lower dir with parent under lower redirect - Check decode of lower dir with grandparent under lower redirect - Check decode of lower dir after rename of lower redirected parent - Check decode of lower dir after rename of lower redirected grandparent This test requires and enables overlayfs NFS export support and merge dir rename support (redirect_dir). NFS export support depends on and requires overlayfs index feature. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-03overlay: test overlay file handles of lower dir with non-indexed ancestorAmir Goldstein3-0/+172
Overlayfs with nfs_export enabled, indexes all directories on copy up. Directory index is requires for decoding lower directory file handles in case ancestors have been renamed. When enabling nfs_export on an overlay that already has non-indexed merge dirs, the possibility of non-indexed ancestor rename requires special handling when encoding lower directory file handles. - Check encode/decode/read file handles of non-indexed merge dir - Check encode/decode/read file handles of dir with non-indexed parent - Check encode/decode/read file handles of dir with non-indexed grandparent - Check decode/read of file handles after rename of non-indexed merge dir - Check decode/read of file handles after rename of non-indexed parent - Check decode/read of file handles after rename of non-indexed grandparent This test requires and enables overlayfs NFS export support and merge dir rename support (redirect_dir). NFS export support depends on and requires overlayfs index feature. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-03generic/{274,315}: Require falloc -k supportRostislav Skudnov2-2/+2
These test cases require filesystem support for FALLOC_FL_KEEP_SIZE flag in fallocate(). Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-02-03generic/307: Require ACL supportRostislav Skudnov1-0/+2
Test checks ctime change on setfacl, which requires ACL support from the underlying filesystem. [eguan: add commit log and source common/attr] Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-30overlay: test encode/decode of non-samefs overlay file handles with renamesAmir Goldstein3-0/+223
This is a variant of overlay file handles with renames test for an overlayfs that is composed of multiple lower layers not on the same underlying fs. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-30overlay: test encode/decode overlay file handles with renamesAmir Goldstein3-0/+207
- Check decode/read of file handles after rename of parent - Check decode/read of file handles after rename of grandparent - Check decode/read of file handles after move to new parent - Check encode/decode/read of file handles in non-upper overlay This test requires and enables overlayfs NFS export support and merge dir rename support (redirect_dir). NFS export support depends on and requires overlayfs index feature. This test covers only encode/decode of file handles for overlayfs configuration of all layers on the same base fs. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-30overlay: test encode/decode of non-samefs overlay file handlesAmir Goldstein3-0/+288
This is a variant of overlay file handles test for an overlayfs that is composed of multiple lower layers not on the same underlying fs. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-30overlay: test encode/decode overlay file handlesAmir Goldstein3-0/+271
- Check encode/write/decode/read content of lower/upper file handles - Check encode/decode/write/read content of lower/upper file handles - Check decode/read of unlinked lower/upper files and directories - Check decode/read of lower file handles after copy up, link and unlink This test requires and enables overlayfs NFS export support. NFS export support depends on and requires overlayfs index feature. This test covers only encode/decode of file handles for overlayfs configuration of all layers on the same base fs. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-30fstests: implement require of multiple overlayfs featuresAmir Goldstein2-6/+23
Some overlayfs features must be checked together, because they cannot be enabled without a dependent feature (e.g. nfs_export and index). Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-29overlay: add a test for multiple redirects to the same lower dirAmir Goldstein3-0/+112
Multiple redirects to the same lower dir will falsely return the same st_ino/st_dev for two different upper dirs and will cause 'diff' to falsely report that content of directories is the same when it is not. This test checks that overalyfs detects and fails lookup of a multiply redirected dir. The check for multiply redirected dir was implemented by kernel commit titled "ovl: hash directory inodes for fsnotify". Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-29overlay/017: require and enable redirect_dirAmir Goldstein2-4/+6
This test renames a merge directory so it needs to enable redirect_dir feature, which is not enabled by default. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-29overlay: consider index dir with whiteouts cleanAmir Goldstein3-5/+15
Several tests check that index dir is empty after upper entries have been unlinked. With nfs_export=on, index will contain a whiteout index entry in that case so, allow chardevs when checking for clean index dir. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-29overlay/036: fix upper/lower dir mismatchAmir Goldstein1-2/+2
Mount option index=on checks on mount that upper dir is not being reused with a different lower dir than the first lower dir it was mounted with. This behavior is verified by test overlay/037. In this test however, it is not desired to fail mount on mismatch of upper/lower, so use the matching upper/lower dirs in this test. The mismatch went unnoticed because the index=off mounts do not verify lower dir and the index=on mounts fails on EBUSY (dir in use by another live mount) before failing on ESTALE (upper/lower dir mismatch). Never the less, fix the mismatch, so a change in the kernel between the two sanity checks (EBUSY vs. ESTALE) won't break the test. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-29ovelray: drop explicit use of OVERLAY_MOUNT_OPTIONSAmir Goldstein3-13/+6
Tests don't need to specify $OVERLAY_MOUNT_OPTIONS for overlay mount helpers. These options have already been assigned to MOUNT_OPTIONS by _overlay_config_override or by _mount_opts and will be added to mount command by _common_dev_mount_options in _overlay_mount_dirs. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-28src/metaperf: Include linux/param.h explicitly for HZ macroRostislav Skudnov1-0/+1
Glibc includes linux/param.h when we include sys/param.h, whereas musl libc does not do that. HZ is a Linux-specific macro, therefore include the header file that defines it explicitly. Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-28src/dmiperf: Include sys/types.h for u_int32_tRostislav Skudnov1-0/+1
u_int32_t type is defined in sys/types.h, which is often included by glibc implicitly when some other headers are used, but other C libraries such as musl may not necessarily do so, therefore an explicit include is needed. Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-25xfs/24[356]: checking cow fork bmap requires CONFIG_XFS_DEBUG=yDarrick J. Wong3-0/+3
These tests requires XFS debugging functionality, so test for that. 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>
2018-01-25generic/403: don't spew '$GETFATTR_PROG: Killed' messagesDarrick J. Wong1-2/+4
Use a runfile presence check to control the background getfattr loop instead of using kill -9. This helps us to avoid the problem that the controlling bash will print a process killed message, which wrecks 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>
2018-01-25xfs/122: fix xfs header ordering problemsDarrick J. Wong1-0/+5
XFS headers are supposed to be included in a certain order so that inline functions actually compile correctly. For the most part the shell feeds us the files in an order that works, but with the addition of the xfs_dir2_dirblock_bytes function this doesn't always work now. Therefore, explicitly #include the headers in the required order. 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>
2018-01-25common/rc: report kmemleak errorsDarrick J. Wong2-0/+62
If kmemleak is enabled, scan and report memory leaks after every test. Note that the kmemleak check support is EXPERIMENTAL! Due to the way kmemleak works, the leak might be from an earlier test, or something totally unrelated. [eguan: add EXPERIMENTAL disclaimer in commit log too] 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>
2018-01-25ext4: Ext4 online resize with bigalloc tests.harshads3-0/+343
Add tests to verify Ext4 online resizing feature with bigalloc feature enabled. We test various resizing scenarios with different cluster sizes. Signed-off-by: Harshad Shirwadkar <harshads@google.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-24generic: test decoding file handles after cycle mountAmir Goldstein4-30/+224
open_by_handle can now store and load file handles from a file: usage: open_by_handle -p -o <handles_file> <test_dir> [N] open_by_handle -p -i <handles_file> <test_dir> [N] Add a new generic/exportfs test to use these new options to test decoding file handles after cycle mount and after directory renames. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-24generic/exportfs: golden output is not silentAmir Goldstein4-4/+0
Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-24src/open_by_handle: verify dir content only with -r flagAmir Goldstein1-1/+1
Without -r flag file handles are opened, but file content is not read. Treat dir file hanldes, similarly. without -r flag, open dir file handle, but don't verify its content. This is going to be used by tests for which dir content is changed between encode and decode of dir file handle. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-24src/pwrite_mmap_blocked: Include signal.h instead of sys/signal.hRostislav Skudnov1-1/+1
sys/signal.h is wrong and should not be used. Musl C library warns about it. Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-24src/t_mtab: Replace sys_siglist[] with strsignal()Rostislav Skudnov1-1/+1
strsignal(3) says that strsignal() should be used instead of sys_siglist[]. Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-24src/fssum: Use htobe64() instead of a custom macroRostislav Skudnov1-7/+2
Remove unnecessary htonll() macro definition. Macros and functions starting with two underscores are usually internal and shouldn't be used by applications when a version without "__" is available. Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-24doio, growfiles: Use standard signal name SIGCHLD instead of SIGCLDRostislav Skudnov2-2/+2
SIGCLD is synonymous with SIGCHLD, but the former is non-standard and not supported by some C libraries such as musl. Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-24fstests: Replace all __[u]intNN_t types with standard [u]intNN_tRostislav Skudnov8-68/+70
Integer types such as __uint32_t are non-standard and not supported by some C libraries such as musl. This commit replaces them with standard types such as uint32_t and includes stdint.h header where necessary. The following command was used to do the changing of types: sed -r -i 's/__(u?int[0-9]{2}_t)/\1/g' src/*.c ltp/*.c Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-24fsstress: Include stddef.h for ptrdiff_tRostislav Skudnov1-0/+1
In musl C library headers ptrdiff_t is only defined in stddef.h. Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-22check: expunge tests when doing a dry runLuis R. Rodriguez1-0/+4
Running ./check with -n will not execute tests, however when exclude files are used we still show them as if they are run. Test the exclude file prior to assuming we can run a test on a dry run. Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-22check: move expunge test into a helperLuis R. Rodriguez1-5/+15
Move the expunge test into a helper. [eguan: make TEST_ID local and use grep -q not io redirection] Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-21xfs: Regression test for invalid sb_logsunitxiao yang3-0/+88
If log stripe unit isn't a multiple of the fs blocksize and mounting, the invalid sb_logsunit leads to crash as soon as we try to write to the log. Signed-off-by: xiao yang <yangx.jy@cn.fujitsu.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-21common: Add _require_no_xfs_bug_on_assert and factor out filter_xfs_dmesgxiao yang4-15/+41
1) Introduce _require_no_xfs_bug_on_assert helper to check if XFS is built with CONFIG_XFS_ASSERT_FATAL, and call _require_no_xfs_debug if bug_on_assert is not available. 2) Apply _require_no_xfs_bug_on_assert in xfs/098 and xfs/115. 3) Move filter_xfs_dmesg from xfs/098 to common/filter, and rename it as _filter_assert_dmesg. [eguan: update comment and _notrun message a bit] Signed-off-by: xiao yang <yangx.jy@cn.fujitsu.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-19xfs/realtime: Fix direct invocations of xfs_repairRichard Wareing2-2/+8
Fixes direct invocations of xfs_repair to add in -r option if required. Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Richard Wareing <rwareing@fb.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-19xfs/realtime: add _require_no_rtinherit functionRichard Wareing5-0/+20
To better exercise the data path code of realtime subvolumes, we will set rtinherit=1 during mkfs calls. For tests which this is not desired we introduce a _require_no_rtinherit function to opt out of this behavior. Signed-off-by: Richard Wareing <rwareing@fb.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-19xfs/realtime: Add require_no_realtime functionRichard Wareing4-2/+21
Some tests do not play well with realtime devices, in an effort to produce a stable set of test which exercise the realtime code paths we introduce a _require_no_realtime function to allow tests to opt out of realtime subvolume test runs. And to make tests generic/409-411 work well with rt device, teach _get_mount now honors $SCRATCH_OPTIONS. Signed-off-by: Richard Wareing <rwareing@fb.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-19common/dmthin: dm-thin lacks DAX supportRoss Zwisler1-0/+5
generic/347 currently fails when run in conjunction with the DAX mount option: generic/347 72s ... - output mismatch (see /root/project/xfstests/results//generic/347.out.bad) --- tests/generic/347.out 2016-05-12 11:56:32.086618744 -0600 +++ /root/project/xfstests/results//generic/347.out.bad 2018-01-17 16:04:33.459348448 -0700 @@ -1,2 +1,3 @@ QA output created by 347 +mount: /mnt/xfstests_scratch: can't read superblock on /dev/mapper/thin-vol. === completed ... (Run 'diff -u tests/generic/347.out /root/project/xfstests/results//generic/347.out.bad' to see the entire diff) This is expected because the dm-thin target currently lacks DAX support. Just skip this test if we are using DAX. Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-19common/xfs: Check if write supports [-c|-d] option in xfs_dbxiao yang1-2/+5
Make sure _scratch_xfs_set_metadata_field() can be used on an old xfsprogs-dev(e.g. v3.1.1). The "-d" option was introduced since xfsprogs-dev v4.7.0 by commit 86769b3 ("xfs_db: allow recalculating CRCs on invalid metadata"). The special argument "--" is only used to end option-scanning in getopt(). getopt() was introduced since xfsprogs-dev v3.2.3 by commit c9f5e3d ("xfs_db: Allow writes of corrupted data")'. Signed-off-by: xiao yang <yangx.jy@cn.fujitsu.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-18shared/272: don't use data journaling with DAXRoss Zwisler1-0/+1
shared/272 fails with kernels v4.15-rc1 and beyond when you are mounted with DAX: shared/272 [failed, exit status 1] - output mismatch (see /root/project/xfstests/results//shared/272.out.bad) --- tests/shared/272.out 2015-12-05 13:12:17.038257578 -0700 +++ /root/project/xfstests/results//shared/272.out.bad 2018-01-17 15:37:18.581631116 -0700 @@ -1,3 +1,3 @@ QA output created by 272 Switch data journalling mode. Silence is golden. -Check filesystem +/usr/bin/chattr: Device or resource busy while setting flags on /mnt/xfstests_scratch/file.1 ... (Run 'diff -u tests/shared/272.out /root/project/xfstests/results//shared/272.out.bad' to see the entire diff) This is expected. The following kernel commit: commit e9072d859df3 ("ext4: prevent data corruption with journaling + DAX") makes "chattr +j", which is attempting to turn on data journaling, return -EBUSY if the ext4 DAX mount option is in use. This was done to prevent the data corruption shown in xfstest ext4/030, added by this xfstests commit: commit 750a24e99e48 ("ext4: test for DAX + journaling corruption") So, just skip shared/272 if the DAX mount option is in use. Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-18btrfs/027: unmount scratch device if test failsLiu Bo1-0/+2
This test, btrfs/027, runs tests against different raid profiles in a loop, if one of them aborts, it also fails the following ones with errors like, Test -m raid10 -d raid10 ERROR: /dev/xxx is mounted Test -m raid5 -d raid5 ERROR: /dev/xxx is mounted Test -m raid6 -d raid6 ERROR: /dev/xxx is mounted _scratch_unmount is added to avoid the above. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-18btrfs/011: umount device in _cleanupLiu Bo1-0/+4
btrfs/011 replaces the first device in SCRATCH_DEV_POOL in test, which is SCRATCH_DEV, and it fails to umount SCRATCH_MNT when it aborts, because _cleanup doesn't do any umount. This may leave SCRATCH_DEV not used but other devices from SCRATCH_DEV_POOL still mounted on SCRATCH_MNT. Then this results in SCRATCH_DEV unusable for subsequent tests because _require_scratch couldn't umount detect & umount SCRATCH_DEV correctly. Fix it by umounting SCRATCH_MNT in _cleanup, so the test always umounts the devices on exit. [eguan: add comments and rewrite summary and commit log] Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Tested-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-14fstests: Add 9p network filesystem supportTuomas Tynkkynen4-3/+44
This commit adds support for the 9p network file system, which is mainly used by QEMU for sharing a file system from the host to the guest VM. To run xfstests on it, launch QEMU with e.g.: -virtfs local,path=$TMPDIR/p9-test,security_model=mapped-xattr,mount_tag=p9-test -virtfs local,path=$TMPDIR/p9-scratch,security_model=mapped-xattr,mount_tag=p9-scratch and inside the VM run xfstests with: export TEST_DEV=p9-test export SCRATCH_DEV=p9-scratch export PLAN9_MOUNT_OPTIONS="-o trans=virtio,version=9p2000.L,cache=loose,posixacl" Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-12generic/015: Change the test filesystem size to 101mbNikolay Borisov1-1/+5
This test has been failing for btrfs for quite some time, at least since 4.7. There are 2 implementation details of btrfs that it exposes: 1. Currently btrfs filesystem under 100mb are created in Mixed block group mode. Freespace accounting for it is not 100% accurate - I've observed consistent 1mb discrepancy between a newly created filesystem, then writing a file and deleting it and checking the free space. 2. BTRFS won't flush it's delayed allocation on file deletion if less than 32mb are deleted. On such files we need to perform sync (missing in the test) or wait until time elapses for transaction commit. In order to avoid both of the aforementioned idiosyncrasies of the fs make the test filesystem 101mb. With this we achieve 2 things: 1. Since the filesystem is larger we can create a file larger than 32mb, so it's going to be flushed upon deletion and numbers acquired from df will be accurate 2. We don't create the filesystem in mixed mode and also since the 1mb is less than %1 of 101mb we will fall within the tolerance of 1% Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-12filter: Introduce filter to filter out offset for xfs_ioQu Wenruo9-153/+173
Some test cases (AFAIK, btrfs RAID recovery test cases) read out certain location to verify its data. Such read is mostly OK, but the golden output contains the on-disk offset, which can differ due to underlying chunk change. (This time is mkfs chunk layout change for btrfs) So introduce macro _filter_xfs_io_offset to filter out the offset part wrote 65536/65536 bytes at offset 136708096 ^^^^^^^^^^^^^^^^^^^^ And offset from "pread -v" 08260000: aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ ^^^^^^^^^ Only btrfs/14[0-3] are affected. Reported-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-12xfs: test for umount hang caused by the pending dquota log item in AILHou Tao3-0/+177
When the first writeback and the retried writeback of dquota buffer get the same IO error, XFS will let xfsaild to restart the writeback and xfs_qm_dqflush_done() will not be invoked. xfsaild will try to re-push the quota log item in AIL, the push will return early everytime after checking xfs_dqflock_nowait(), and xfsaild will try to push it again. IOWs, AIL will never be empty, and the umount process will wait for the drain of AIL, so the umount process hangs. Signed-off-by: Hou Tao <houtao1@huawei.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-12common/rc: factor out _scratch_xfs_[get|set]_sb_fieldHou Tao10-72/+64
It's common to get and set the values of fields in XFS super block, so factor them out as scratch_xfs_[get|set]_sb_field, reimplement them based on _scratch_xfs_[get|set]_metadata_field, and update the related test cases accordingly. Also move _scratch_xfs_[get|set]_metadata_field from common/fuzzy to common/xfs. Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Hou Tao <houtao1@huawei.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-12dmflakey: support error_writes feature for dm-flakeyHou Tao1-1/+23
Add _require_flakey_with_error_writes() to check the availability of dm-flakey target and its error_writes feature, and support for enabling FLAKEY_TABLE_ERROR table by passing FLAKEY_ERROR_WRITES to _load_flakey_table(). Signed-off-by: Hou Tao <houtao1@huawei.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-12dmflakey: support multiple dm targets for a dm-flakey deviceHou Tao1-2/+5
dm-flakey can be used to emulate IO write error, however, when we also need to prevent the IO error for a specific range of the block device (eg., the log region of a XFS), we need to specify multiple dm targets for the dm device. Option --table can not accommodate the multiple dm targets case, so let dmsetup get the possible-multiple-targets table from standard input. Signed-off-by: Hou Tao <houtao1@huawei.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-12common/rc: ext4 doesn't support O_DIRECT with data journalingEric Whitney1-0/+2
Modify _require_odirect() to skip O_DIRECT tests if the ext4 mount option data=journal has been applied. Because ext4 disables its O_DIRECT support when in data journaling mode, no significant value is obtained by running these tests and they consume a significant amount of run time. Additionally, this change eliminates the need to triage false negative O_DIRECT test results caused by test problems, as has occurred from time to time. Signed-off-by: Eric Whitney <enwlinux@gmail.com> Reviewed-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-10common/rc: perform _require_metadata_journaling check on overlay base fsChengguang Xu1-0/+12
Currently generic shutdown tests are enabled on overlayfs by extending _require_scratch_shutdown() to check shutdown support for overlayfs, some of those tests also call _require_metadata_journaling() to inspect whether test filesystem support metadata journaling or not, so need to extend _require_metadata_journaling() as well to check metadata journaling support for overlayfs in case shutdown tests run on uncommon overlayfs setup and fail. For example, base filesystem of overlayfs is ext2 or ext4 with noload mode. Metadata journaling check is based on base filesystem configurations and because -overlay option saves those configurations to OVL_BASE_*, adding restore/override the configurations before/after the check. Tested ext2, xfs, ext4(load/no-load mode) as base filesystem of overlayfs in single and multi section configurations. [eguan: update _notrun message] Signed-off-by: Chengguang Xu <cgxu519@icloud.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-09xfs: find libxfs api violationsDarrick J. Wong3-0/+59
New test to run tools/find-api-violations.sh in xfsprogs. 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>
2018-01-06ext4: test for inline data + DAX corruptionRoss Zwisler6-1/+161
Add a regression test for the following kernel commit: ext4: prevent data corruption with inline data + DAX The test passes either if we don't encounter corruption, or if mounting with DAX + inline data fails. The latter is the way that we prevent this issue in the kernel. [eguan: add 'dax' group] Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-06ext4: test for DAX + journaling corruptionRoss Zwisler6-1/+182
Add a regression test for the following kernel commit: ext4: prevent data corruption with journaling + DAX The test passes if either we successfully compare the data between the mmap with journaling turned on and the one with journaling turned off, or if we fail the chattr command to turn on or off journaling. The latter is how we prevent this issue in the kernel. [eguan: add 'dax' group] Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-06xfs/068: fix clonerange problems in file/dir count outputDarrick J. Wong1-0/+11
In this test we use a fixed sequence of operations in fsstress to create some number of files and dirs and then exercise xfsdump/xfsrestore on them. Since clonerange/deduperange are not supported on all xfs configurations, detect if they're in fsstress and disable them so that we always execute exactly the same sequence of operations no matter how the filesystem is configured. [eguan: move it from xfs/068 to common/dump as Dave suggested] Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Suggested-by: Dave Chinner <david@fromorbit.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-06btrfs: make sure scrub fixes raid6 corruptionLiu Bo3-0/+125
This is to reproduce a bug of scrub, with which scrub is unable to repair raid6 corruption as expected. The kernel side fixes are Btrfs: make raid6 rebuild retry more Btrfs: fix scrub to repair raid6 corruption Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-06generic: run a long-soak write-only fsstress testDarrick J. Wong3-0/+67
Let a lot of writes soak in with multithreaded fsstress to look for bugs and other problems. [eguan: remove '-v' option of fsstress and remove 'clone' group] 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>
2018-01-03generic/050: fix _require_local_device $SCRATCH_DEV check orderLuis Henriques1-1/+1
Commit 2b4eae7fd825 ("common/rc: add scratch shutdown support for overlayfs") added a _require_local_device check to generic tests 042 and 050. However, for test 050, this check was added _before_ actually verifying that a SCRATCH_DEV actually exists. This patch simply re-orders the _require_local_device to the right place. Signed-off-by: Luis Henriques <lhenriques@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2018-01-02fsstress: implement the clonerange/deduperange ioctlsDarrick J. Wong1-0/+391
Mix it up a bit by reflinking and deduping data blocks when possible. 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>
2018-01-02generic: test error shutdown while stressing filesystemDarrick J. Wong3-0/+100
Test log recovery with repeated (simulated) disk failures. We kick off fsstress on the scratch fs, then switch out the underlying device with dm-error to see what happens when the disk goes down. Having taken down the fs in this manner, remount it and repeat. This test is a Good Enough (tm) simulation of our internal multipath failure testing efforts. 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>
2017-12-31ext4: use a slightly bigger file system in ext4/021Theodore Ts'o1-2/+2
An 8 MB file system may not be big enough for certain file system configurations --- in particular, if the inode size is 2048 bytes. Make the test file system 10MB instead. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-31common/encrypt: Create an encrypted equivalent of _scratch_mkfs_sizedAri Sundholm2-2/+13
Test case generic/399 hardcodes "-O encrypt" in MKFS_OPTIONS when calling _scratch_mkfs_sized, which only works with the mkfs of certain filesystems. Create a new helper, _scratch_mkfs_sized_encrypted, for handling the differences between the mkfs tools of different filesystems. It also allows those filesystems whose mkfs doesn't accept "-O encrypt" to skip the test gracefully until proper support is added for them in the helper. ubifs is not supported in the new helper despite supporting encryption, as _scratch_mkfs_sized has no ubifs support and adding that should be done in a separate patch. Signed-off-by: Ari Sundholm <ari@tuxera.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-31btrfs: Add new 'limit' test group for btrfsQu Wenruo1-6/+6
Btrfs qgroup also supports to limit the usage of specified qgroups. It's possible to enable qgroup but doesn't enable limit. (Most user won't use qgroup limit for various problems) So add a new test group 'limit' for btrfs, as a subset of existing 'qgroup' group. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-24xfs/040: document purposeLuis R. Rodriguez1-0/+5
Getting xfs/040 to "pass" takes a bit of effort, however the effort to require updating xfsprogs is purely an xfsprogs maintainer task only. There no functional gain by users of xfs or a QA team to get this test to pass. This is not trivial from the current description so document this. Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Reviewed-by: Bill O'Donnell <billodo@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-24generic: add syncfs testChengguang Xu3-0/+87
Inspired by syncfs bug of overlayfs which does not sync dirtyinodes in underlying filesystem. Run syncfs and shutdown filesystem(or underlying filesystem of overlayfs) to check syncfs result. Signed-off-by: Chengguang Xu <cgxu519@icloud.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-24common/rc: check syncfs supportChengguang Xu1-0/+4
Add a check case in _require_xfs_io_command() to support syncfs Signed-off-by: Chengguang Xu <cgxu519@icloud.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-24common/rc: add scratch shutdown support for overlayfsChengguang Xu19-20/+55
Enable shutdown tests on overlayfs. This requires configuring overlayfs with TEST|SCRATCH_DEV pointing to block device, which act as base fs of overlay. The legacy config (pointing TEST|SCRATCH_DEV to existing directories) won't support shutdown. Extend _require_scratch_shutdown() to deal with overlay by checking shutdown support on $OVL_BASE_SCRATCH_MNT instead of $SCRATCH_MNT, so we check shutdown support status against the underlying upper fs of overlay. Introduce new _scratch_shutdown() helper to do the actual shutdown work and shutdown upper fs in the case of overlay. Also converting existing bare 'src/godown' calls to use this helper to avoid false failures when testing overlayfs. generic/042 and generic/050 assume $SCRATCH_DEV to be a local device, so add _require_local_device $SCRATCH_DEV rule. [eguan: rewrite commit log] Signed-off-by: Chengguang Xu <cgxu519@icloud.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-24fsstress: getcwd() return value fixesAri Sundholm1-1/+5
Add a check for the return value of getcwd(). Fix another check which mistakenly checks if the return value is less than zero instead of checking whether the return value is NULL. Signed-off-by: Ari Sundholm <ari@tuxera.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-24fsstress: Eliminate valgrind noiseAri Sundholm1-0/+5
This patch plugs what we think are the remaining sources of valgrind noise we found when running fsstress under valgrind. The noise is caused by memory being left unfreed before process termination. Signed-off-by: Ari Sundholm <ari@tuxera.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-15README: document group fsgqa is requiredLuis R. Rodriguez1-0/+1
The group fsgqa is also required. Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-15xfs: fix tests to handle removal of no-alloc create nonfeatureDarrick J. Wong4-4/+9
We're removing from XFS the ability to perform no-allocation file creation. This was added years ago because some customer of SGI demanded that we still be able to create (empty?) files with zero free blocks remaining so long as there were free inodes and space in existing directory blocks. This came at an unacceptable risk of ENOSPC'ing midway through a transaction and shutting down the fs, so we're removing it for the create case having changed our minds 20 years later. However, some tests fail as a result, so fix them to be more flexible about not failing when a dir/file creation fails due to ENOSPC. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-15generic/45[34]: test line draw characters in file/attr namesDarrick J. Wong2-0/+10
Try to draw a multiline rectangular outline in a file name and xattr name, just to see if we can. 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>
2017-12-15common/xfs: fix scrub support probing againDarrick J. Wong1-1/+1
In the final version of the xfs_io scrub command we don't allow the probe function to have any parameters, so fix the helper to abide that. 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>
2017-12-15build: update AC_PACKAGE_WANT_GDBM() and src/dbtest.c to buildLuis R. Rodriguez2-0/+9
Modern gdbm-devel packages bundle together gdbm.h and ndbm.h. The old m4 macro had detection support for some old gdbm libraries but not for new ones. We fix compilation of src/dbtest.c by making the autoconf helper check for this new arrangement: If both gdbm.h and ndbm.h are found define set both gdbm_ndbm_=true, and have_db=true, and define HAVE_GDBM_H. The src/dbtest.c already had a HAVE_GDBM_H but there was never a respective autoconf settter for it. We can just re-use this and fix it for new arrangement. Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-14generic/group: add 304 to dedupe groupLuis R. Rodriguez1-1/+1
Other generic tests that test dedupe all have 'dedupe' group except generic/304. Add 304 to dedupe group too. [eguan: add commit log] Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-14generic: initial fiemap range query testNikolay Borisov4-0/+311
Fiemap gained support for passing in optional offset len which denote the range requested, so this patch adds testcases for this functionality. Aditionally, a special "ranged" argument is added to the require_xfs_io_command which checks for the presence of fiemap range support. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-14generic: Partial direct write testGoldwyn Rodrigues3-0/+106
Getting an error midway through a direct write would return an error and the error-code is returned in the write() call. However, partial data is over-written during the call. This tests simulates the ENOSPC error to check for partial direct write consistency. [eguan: use $AWK_PROG instead of bare awk] Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-14generic: Test RWF_NOWAITGoldwyn Rodrigues3-0/+89
Tests the RWF_NOWAIT flag so the I/O returns immediately with -EAGAIN on a new file since it requires block allocation. It creates a file, syncs it, and overwrites the file with RWF_NOWAIT. This should succeed. Finally, read the contents to make sure the overwrite is successful. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-14common/rc: Check pwrite parameters in _require_xfs_io_commandGoldwyn Rodrigues1-1/+15
There are some parameters added with xfs_io. Check if the pwrite parameters are available. For some cases, xfs_io now returns "command -%c not supported", so added "not supported" to count as error. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-14common/populate: fix S_IFDIR.FMT_BLOCK and ATTR.FMT_LOCAL for ext4 encryptionTheodore Ts'o1-2/+2
When ext4 encryption is enabled, the directory entries are encrypted so we need to create fewer directory entries to guarantee that they will all fit in a single block. Also, the encryption metadata takes up extended attribute room so we can only add a single xattr to guarantee that the xattrs will fit in the inode. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-12common: rework _require_ext4_mkfs_featureTheodore Ts'o5-31/+21
In all of the places where we need check to see if mkfs.ext4 can support a set of file system features, we also should be checking to see if the kernel can support those file system features. So rename _require_ext4_mkfs_feature to _require_scratch_ext4_feature, and actually format the file system in $SCRATCH_DEV. Also allow ext4/306 to run on systems where mke2fs doesn't support the "64bit" option. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-10build: fix Wlog_Error_String overflow issuesRoss Zwisler1-3/+4
The 'Wlog_Error_String' string is defined to be 256 bytes in length, but in two places we write into it with a format that contains a string (wfile->w_file) that has length 1024. This can overflow Wlog_Error_String, as we see in the new compiler warnings from gcc 7.2.1: write_log.c:124:37: warning: ā€˜%sā€™ directive writing up to 1023 bytes into a region of size 224 [-Wformat-overflow=] "Could not open write_log - open(%s, %#o, %#o) failed: %s\n", ^~ Fix this by increasing the length of Wlog_Error_String to 1280 characters (1024 for wfile->w_file plus 256 for the rest of the format string), and by using snprintf() instead of sprintf() so we are sure we don't overflow. Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-10build: fix TagName overflow issuesRoss Zwisler3-3/+3
The 'TagName' string is defined to be 40 characters in length, but in three places we write into it with a format of "(%.39s)". This can result in a string of up to 42 characters, the 39 character user string plus "()\0". This overflows TagName, as we see in the new complier warnings from gcc 7.2.1: iogen.c:1277:6: note: 'sprintf' output between 3 and 42 bytes into a destination of size 40 sprintf( TagName, "(%.39s)", optarg ); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix this by limiting the user string to 37 characters. Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-10build: fix _BSD_SOURCE complier warningRoss Zwisler1-0/+1
When compiling xfstests with either gcc 6.4.1 or 7.2.1 I see the following warning: In file included from /usr/include/stdio.h:27:0, from fssum.c:25: /usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp] # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" ^~~~~~~ The feature_test_macros(7) man page says this about _BSD_SOURCE: Since glibc 2.20, this macro is deprecated. It now has the same effect as defining _DEFAULT_SOURCE, but generates a compile-time warning (unless _DEFAULT_SOURCE is also defined). Use _DEFAULT_SOURCE instead. To allow code that requires _BSD_SOURCE in glibc 2.19 and earlier and _DEFAULT_SOURCE in glibc 2.20 and later to compile without warnings, define both _BSD_SOURCE and _DEFAULT_SOURCE. Keep backwards compatibility with older code by defining both _BSD_SOURCE and _DEFAULT_SOURCE. Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-10generic: add test for DAX MAP_SYNC supportRoss Zwisler4-0/+120
This test creates a file and writes to it via an mmap(), but never syncs via fsync/msync. This process is tracked via dm-log-writes, then replayed. If MAP_SYNC is working the dm-log-writes replay will show the test file with 1 MiB of on-media block allocations. This is because each allocating page fault included an implicit metadata sync. If MAP_SYNC isn't working (which you can test by removing the "-S" flag to xfs_io mmap) the file will be smaller or missing entirely. Note that dm-log-writes doesn't track the data that we write via the mmap(), so we can't do any data integrity checking. We can only verify that the metadata writes for the page faults happened. [eguan: add comments on _require_log_writes_dax and fix its cleanup] Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-08dm-log-writes: only replay log to marks that existRoss Zwisler1-0/+4
The 'replay-log' executable will replay the dm-log-writes log until the given mark, or until the end of the log if the mark isn't found. This means that if the mark you're looking for was never inserted in the log or if you give garbage to _log_writes_replay_log() the entire log will be replayed. This can cause unexpected test results. Fix this by making sure that the mark we're given actually exists in the log before we allow the replay. Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-06btrfs: reproduce a read failure on raid6 setupLiu Bo3-0/+132
This test case is to reproduce a bug of raid6 reconstruction process. The kernel fix are Btrfs: do not merge rbios if their fail stripe index are not identical Btrfs: make raid6 rebuild retry more [eguan: whitespace and indention fix, add 'raid' group] Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-06btrfs/124: add balance --full-balance optionAnand Jain2-1/+12
btrfs balance needs --full-balance option since 4.6, so check the version and then use it. As this may be useful for other btrfs tests as well, so this patch also adds _run_btrfs_balance_start() to the common/btrfs file. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-04generic/459: Fix check for ro-remount in extNyang xu1-3/+6
Currently ,freeze failure caused by the lack of space can not guarantee to remount extN filesystem in read-only mode, and test failed due to "ro" mount option not found. We can add a touch to trigger the action which aborts journal and ro-remounts the fs. [eguan: update commit log and comments a bit] Signed-off-by: yang xu <xuyang.jy@cn.fujitsu.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-01btrfs: make sure btrfs can handle full fs trim correctlyQu Wenruo3-0/+123
Ancient commit f4c697e6406d ("btrfs: return EINVAL if start > total_bytes in fitrim ioctl") introduced a regression where btrfs may fail to trim any free space in existing block groups. It's caused by confusion with btrfs_super_block->total_bytes and btrfs logical address space. Unlike physical address, any aligned bytenr in range [0, U64_MAX) is valid in btrfs logical address space, and it's chunk mapping mechanism of btrfs to handle the logical<->physical mapping. The test case will craft a btrfs with the following features: 0) Single data/meta profile Make trimmed bytes reporting and chunk allocation more predictable. 1) All chunks start beyond super_block->total_bytes (1G) By relocating these blocks several times. 2) Unallocated space is less than 50% of the whole fs 3) Fragmented data chunks Data chunks will be full of fragments, 50% of data chunks will be free space. So in theory fstrim should be able to trim over 50% space of the fs. (after fix, 64% of the fs can be trimmed) While the regression makes btrfs only able to trim unallocated space, which is less than 50% of the total space. (without fix, it's only 31%) Fixed by patch named "btrfs: Ensure btrfs_trim_fs can trim the whole fs". Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-01overlay/042: remove wrong check for empty indexAmir Goldstein1-4/+0
The check for empty index in this test was wrongly copied from test overlay/034. In test overlay/034 lower file starts as a hardlink, so nlink accounting is done from the first copy up and index can be cleaned on last upper hardlink unlink. In this test, lower starts as non-hardlink, so first copy up does not perform nlink accounting and therefore, union nlink count does not drop to 0 at the end of the test and the index is not expected to be cleaned. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-01overlay: regression test for orphan index cleanup on mountAmir Goldstein3-0/+160
Test nlink accounting of overlay hardlinks with offline modifications. nlink of overlay inode should account for the union of lower and upper hardlinks. Orphan index inodes with union nlink 0 should be cleaned on mount. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-01overlay: regression test for hardlink breakage after unlink and mount cycleAmir Goldstein3-0/+124
- file A and B are hardlinked in lower - modify A to trigger copy up and index lower - unlink A and mount cycle - check that B still contains the modified data Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-12-01generic/388: use TIME_FACTOR to scale test durationDarrick J. Wong1-1/+1
Use TIME_FACTOR to increase the amount of time we spend testing log shutdown recovery. 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>
2017-11-28btrfs: test send for files with multiple hard links renamedFilipe Manana3-0/+154
Test that an incremental send operation works if a file that has multiple hard links has some of its hard links renamed in the send snapshot, with one of them getting the same path that some other inode had in the send snapshot. At the moment this test fails on btrfs and a fix is provived by a linux kernel patch titled: "Btrfs: incremental send, fix wrong unlink path after renaming file" Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-28generic/465: just check the actual read data under dio read/writeXiao Yang1-5/+6
I got the following message when running generic/465 in ext4 data=journal mode --------------------------------------------------------------- QA output created by 465 non-aio dio test encounter an error: block 0 offset 4096, content 62 encounter an error: block 0 offset 122880, content 62 encounter an error: block 0 offset 274432, content 62 encounter an error: block 0 offset 86016, content 62 aio-dio test encounter an error: block 0 offset 28672, content 62 encounter an error: block 0 offset 12288, content 62 encounter an error: block 2 offset 16384, content 62 encounter an error: block 1 offset 565248, content 62 --------------------------------------------------------------- In ext4 data=journal mode, direct read will fall back to buffer read, and buffer read doesn't take inode lock, so it doesn't need to wait for the writer to finish first and sees the intermediate inode size and returns data less than 1M. We can just check the actual read data instead of the whole read buffer. Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-26fstests: filter readonly mount error messagesEryu Guan5-16/+67
util-linux commit 6dede2f2f7c5 ("libmount: support MS_RDONLY on write-protected devices") changed the error message on read-only block device, and in the failure case printed one line message instead of two (for details please see comments in common/filter), and this change broke generic/050 and overlay/035. Fix it by adding more filter rules to _filter_ro_mount and updating associated .out files to unify the output from both old and new util-linux versions. Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-26overlay/036: filter busy mount messageEryu Guan3-4/+16
util-linux v2.30 changed error message of a busy mount and caused overlay/036 to fail. e.g. - mount: <device> is already mounted or <mountpoint> busy + mount: <mountpoint>: <device> already mounted or mount point busy. Filter the mount output by a newly introduced _filter_busy_mount into a unified format. mount: device already mounted or mount point busy Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-26fstests: filter mount error message for EUCLEAN and ESTALEEryu Guan6-12/+33
util-linux commit ea848180dd34 ("libmount: add mnt_context_get_excode()") since v2.30 changed the error message on EUCLEAN and ESTALE again (and maybe other errno too): - mount: <device> on <mountpoint> failed: Structure needs cleaning + mount: <mountpoint>: mount(2) system call failed: Structure needs cleaning. and it causes xfs/005, overlay/037 to fail (and probably xfs/333 too, but it's always _notrun for now). And what's more, the mentioned tests would also fail when testing with util-linux prior to v2.21, no one complained just because the tests are usually _notrun on such old distributions that ship util-linux < v2.21. So let's filter out the changing parts and keep the error message simple. Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-26generic/456: document the fix commitAmir Goldstein1-0/+5
Add a link to Ted's post with more details about the bug and the fix. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-26generic/458: document the fix commitAmir Goldstein1-0/+3
Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-26overlay/038: test consistent values of st_ino/d_ino for subdirsChandan Rajendra1-5/+34
This commit implements similar changes made to overlay/038 test i.e. in addition to checking consistent values of st_ino/d_ino for "." and ".." entries, check also the values for subdir inside each tested directory setup. Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-26overlay/038: code cleanupChandan Rajendra1-39/+27
This commit implements similar changes made to overlay/041 test i.e. - Remove duplicate merged dir tests - Remove duplicate pure upper dir inside merged dir tests - Sort out comments and error messages Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-26generic/459: add check for dm-snapshot targetXiao Yang1-0/+1
generic/459 should be skipped when dm-snapshot is not supported. Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-26perf: a random write buffered fio perf testJosef Bacik4-0/+103
This uses the new fio results perf helpers to run a rand write buffered workload on the scratch device. [eguan: add Makefile] Signed-off-by: Josef Bacik <jbacik@fb.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-26fstests: add fio perf results supportJosef Bacik13-3/+477
This patch does the nuts and bolts of grabbing fio results and storing them in a database in order to check against for future runs. This works by storing the results in resuts/fio-results.db as a sqlite database. The src/perf directory has all the supporting python code for parsing the fio json results, storing it in the database, and loading previous results from the database to compare with the current results. This also adds a PERF_CONFIGNAME option that must be set for this to work. Since we all have various ways we run fstests it doesn't make sense to compare different configurations with each other (unless specifically desired). The PERF_CONFIGNAME will allow us to separate out results for different test run configurations to make sure we're comparing results correctly. Currently we only check against the last perf result. In the future I will flesh this out to compare against the average of N number of runs to be a little more complete, and hopefully that will allow us to also watch latencies as well. [eguan: add required Makefile updates] Signed-off-by: Josef Bacik <jbacik@fb.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-20overlay/041: use user defined overlay mount optionAmir Goldstein1-2/+4
Mount non-samefs dirs with OVERLAY_MOUNT_OPTIONS, so user can opt-in for constant inode numbers on non-samefs setup (i.e. -o xino) when it is implemented. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-20overlay/041: test consistent values of st_ino/d_ino for subdirsAmir Goldstein1-4/+35
In addition to checking consistent values of st_ino/d_ino for "." and ".." entries, check also the values for subdir inside each tested directory setup. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-20overlay/041: code cleanupAmir Goldstein1-40/+27
- Remove duplicate merged dir tests - Remove duplicate pure upper dir inside merged dir tests - Sort out comments and error messages Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-20overlay: Test hardlink breakage on non-samefs setupChandan Rajendra3-0/+167
This commit adds a test to check hardlink breakage when the overlayfs instance is composed of two different underlying filesystem instances. For example, $ mount -t xfs /dev/loop0 /mnt/test $ mount -t xfs /dev/loop1 /mnt/scratch $ mkdir /mnt/scratch/upper $ mkdir /mnt/scratch/work $ mount -t overlay overlay -o lowerdir=/mnt/test \ -o upperdir=/mnt/scratch/upper \ -o workdir=/mnt/scratch/work /mnt/merge Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-20overlay: Test consistent st_ino numbers for non-samefs scenarioChandan Rajendra3-0/+163
This commit adds a test to verify consistent st_ino feature when the overlayfs instance is composed of two different underlying filesystem instances. For example, $ mount -t xfs /dev/loop0 /mnt/test $ mount -t xfs /dev/loop1 /mnt/scratch $ mkdir /mnt/scratch/upper $ mkdir /mnt/scratch/work $ mount -t overlay overlay -o lowerdir=/mnt/test \ -o upperdir=/mnt/scratch/upper \ -o workdir=/mnt/scratch/work /mnt/merge The goal of this test is to verify that overlayfs returns consistent st_ino for the following scenarios, - Copy-up of lowerdir files - Rename files and drop dentry/inode cache - Remount the overlayfs instance Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-20overlay/018: Add constant d_ino testChandan Rajendra1-6/+15
Constant d_ino for hardlinks is possible only when "index" config feature/mount option is enabled. Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-20overlay/017: Remove constant st_ino/d_ino test for hardlinksChandan Rajendra1-3/+1
Constant st_ino/d_ino for hardlinks requires "index" config feature/mount option to be enabled. overlay/018 already tests constant st_ino feature for hardlinks. A future commit will add constant d_ino test to overlay/018 test. Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-18generic: test zero page cache beyond new EOF on truncate downEryu Guan3-0/+145
From mmap(2) manpage, "a file is mapped in multiples of the page size. For a file that is not a multiple of the page size, the remaining memory is zeroed when mapped", this test is to test this behavior on truncate down. This is inspired by an XFS bug that truncate down fails to zero page cache beyond new EOF and causes stale data written to disk unexpectedly and a subsequent mmap sees non-zeros post EOF. Patch "xfs: truncate pagecache before writeback in xfs_setattr_size()" fixed the bug on XFS. Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-16btrfs/143: make test case more reliableLiu Bo1-10/+10
This changes to use '_scratch_cycle_mount' to drop all caches btrfs could have in order to avoid an issue that drop_caches somehow doesn't work on Nikolay's box. Also use bash -c to run 'read' only when %pid is odd so that we can read the faulty disk. Reported-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Tested-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-16xfs/122: don't check xfs_iext_cursorDarrick J. Wong1-0/+1
Don't size-check the incore extent map cursor; it's not a disk structure. 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>
2017-11-16common/rc: check dmesg for UBSAN errorsDarrick J. Wong1-0/+1
If the UBSAN complains about bad behavior, we should capture the dmesg so that developers can inspect it. 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>
2017-11-16aio-dio-append-write-read-race: abort if we encounter syscall errorsDarrick J. Wong1-23/+21
If any of the library calls return error codes, just print out a message and abort the test. Whoever wrote the write test did not check for write failures, which means that if we ENOSPC without writing anything then the reader thread will loop forever trying to read. 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>
2017-11-16generic/45[34]: add emoji to the unusual fs naming testDarrick J. Wong2-0/+10
Since we have a test to make sure that we can use Unicode points in filesystem names, enhance it to check emoji names too. 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>
2017-11-16common/fuzzy: if the fuzz verb is random, keep fuzzing until we get a new valueDarrick J. Wong1-3/+8
If the fuzz verb is 'random', keep generating new random values until we get one that is distinct from the previous value. 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>
2017-11-15generic: add testcase to test fallocate & f{data,}syncChao Yu3-0/+138
f2fs can skip isize updating in fsync(), since during mount, f2fs tries to recovery isize according to valid block address or preallocated flag in last fsynced dnode block. However, fallocate() breaks our rule with setting FALLOC_FL_KEEP_SIZE flag, since it can preallocated block cross EOF, once the file is fsynced, in POR, we will recover isize incorrectly based on these fallocated blocks. This patch adds a new testcase to test fallocate, in order to verify whether filesystem will do correct recovery on isize. Signed-off-by: Chao Yu <yuchao0@huawei.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-15btrfs: test for device dynamic rescanAnand Jain3-0/+196
Make sure missing device is included in the alloc list when it is scanned on a mounted FS. This test case needs btrfs kernel patch which is in the ML [PATCH] btrfs: handle dynamically reappearing missing device Without the kernel patch, the test will run, but reports as failed, as the device scanned won't appear in the alloc_list. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-14src/t_dir_type.c: Use strtoul() instead of atoll()Chandan Rajendra1-1/+1
An overlayfs filesystem instance with one lowerdir filesystem and with "xino" mount option enabled can have the layer index encoded in the 63rd bit of the inode number. A signed 64 bit integer won't suffice to store this inode number. Hence this commit uses strtoul() to convert the inode number in string form to unsigned integer form. Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-10generic/204: use available blocks to determine the number of files to createDarrick J. Wong1-2/+12
Use the available block count to compute the number of files we think we can create, rather than hardcoding a particular size. This fixes the ENOSPC failures for xfs filesystems with rmap/reflink support. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-10xfs: test that we don't leak inodes and dquots during failed cow recoveryDarrick J. Wong8-0/+332
Add a couple of tests to check that we don't leak inodes or dquots if CoW recovery fails and therefore the mount fails. 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>
2017-11-10common/fuzzy: ignore padding fields on xfsDarrick J. Wong1-4/+10
Padding fields are never checked and can have arbitrary values (if we ever put them to use there'll be a feature flag) so there's no point in fuzz-testing them. 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>
2017-11-10xfs/31[2-7]: hide pwrite fsync errors that are supposed to failDarrick J. Wong6-6/+6
xfs_io 4.14 will gain the ability to print error messages when pwrite+fsync fail. Certain tests use the error injector to cause failures, so the errors are expected. Since we test for a shut down filesystem after the error injection, we can push the error messages to the log. 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>
2017-11-10fstests: do not call _scratch_mkfs_sized in a pipeEryu Guan2-3/+4
_scratch_mkfs_sized will create a filesystem of the given size, and call _notrun and exit if current $FSTYP doesn't support sized mkfs. But when it's called in a pipe, the exit in _notrun only exits from the subshell created by the pipe not the test itself, and test continues to run unnecessarily, though the test is still reported as [notrun] due to existence of $seqres.notrun file. Fix it by not calling _scratch_mkfs_sized in a pipe, but dumping the output to a tmp file, which will be fed to _filter_mkfs later. Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-10ltp/fsx: allow comments when reading operations from logsEryu Guan1-1/+1
We use '--replay-ops' option to replay operations in the specified operation log file, but we're not allowed to add comments for the operations in the log, which might be useful when writing regression tests that replay a given sequence of operations. Now treat lines starting with '#' as comments and skip them when reading operations. Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-10common/filter.btrfs: add 'zstd' to compress property filterMisono, Tomohiro1-1/+1
This fixes the false failure of btrfs/059 when running with the mount option '-o compress=zstd'. Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-10generic: add test with more open by file handle use casesAmir Goldstein3-0/+130
This test is a variant of test generic/426 that tests with less files and more use cases: - Create test dir with non empty files with known content and verify their content after opening file by handle. - Check open by handle of directory. - Check open by handle of files that have been unlinked, but still open. - Check open by handle of files that have been renamed in same dir, moved to new dir and whose parent dir has been renamed. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-10generic/426: factor out helper functionsAmir Goldstein2-11/+33
Helper test_file_handles() outputs the sub-test command to output, so if errors are detected in one of the sub-tests, it is easier to know which sub-tests have failed. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-10open_by_handle: test file handles of open filesAmir Goldstein1-10/+31
usage: open_by_handle -dk <test_dir> [N] Get file handles for existing test set, keep open file handles for all test files, unlink all test files, drop caches and try to open all files by handle. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-10open_by_handle: test directory file handleAmir Goldstein1-13/+101
usage: open_by_handle -cp <test_dir> [N] usage: open_by_handle -p <test_dir> [N] usage: open_by_handle -dp <test_dir> [N] With -p flag, create/delete also the test_dir itself and try to open by handle also test_dir itself after droping caches and use dir fd to test faccessat() of a file inside dir. mount_fd argument to open_by_handle_at() is open fd of test_dir's parent. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-10open_by_handle: test content of open file handleAmir Goldstein1-7/+63
usage: open_by_handle -rwa <test_dir> [N] Get file handles for existing test set, write data to files, drop caches, open all files by handle, read data and verify old data, write new data to files. This is needed for testing that overlay decoded file handles are not pointing the lower inodes after new data is already written to upper inodes after copy up. open_by_handle -a is needed for testing copy up of disconnected overlay decoded file handles (to index dir). Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>