summaryrefslogtreecommitdiff
path: root/.gitignore
AgeCommit message (Collapse)Author
2023-02-25generic: add test for direct io partial writesBoris Burkov
btrfs recently had a bug where a direct io partial write resulted in a hole in the file. Add a new generic test which creates a 2MiB file, mmaps it, touches the first byte, then does an O_DIRECT write of the mmapped buffer into a new file. This should result in the mapped pages being a mix of in and out of page cache and thus a partial write, for filesystems using iomap and IOMAP_DIO_PARTIAL. Signed-off-by: Boris Burkov <boris@bur.io> Reviewed-by: Zorro Lang <zlang@redhat.com> Reviewed-by: David Disseldorp <ddiss@suse.de> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-02-08fuzzy: add a custom xfs find utility for scrub stress testsDarrick J. Wong
Create a new find(1) like utility that doesn't crash on directory tree changes (like find does due to bugs in its loop detector) and actually implements the custom xfs attribute predicates that we need for scrub stress tests. This program will be needed for a future patch where we add stress tests for scrub and repair of file metadata. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2022-12-11fstests: batch update of file mode and untracked filesv2022.12.11Shiyang Ruan
1. The executable binary in src/ should be in ignore file. 2. tests/xfs/216.out is a symlink generated at runtime, also should be ignored. 3. tests/generic/692 was created with 644. It should be 755 otherwise its mode will be changed and dirty the git tree after test. Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com> Reviewed-by: Zorro Lang <zlang@redhat.com>
2022-08-06xfs: add memory failure test for dax modeShiyang Ruan
Make sure memory failure mechanism works when filesystem is mounted with dax option. Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2022-07-24ext4: add test for ext4 uuid get/set ioctls during fsstress.Jeremy Bongio
Adds a utility to get/set uuid through ext4 ioctl. Executes the ioctls while running fsstress. These ioctls are used by tune2fs to safely change the uuid without racing other filesystem modifications. Reviewed-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Jeremy Bongio <bongiojp@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Zorro Lang <zlang@kernel.org>
2022-05-15src/vfs: rename idmapped-mounts.c fileChristian Brauner
The idmapped mounts test suite has grown to cover a lot of generic vfs functionality that is not concerned with idmapped mounts at all. As was discussed upstream it's time to rename it to something that reflects its generic nature. So rename the source file from idmapped-mounts.c to vfstest.c before we split it into multiple source files in the next patches. [Zorro: fix generic/689] Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2022-05-15src: rename idmapped-mounts folderChristian Brauner
The idmapped mounts test suite has grown to cover a lot of generic vfs functionality that is not concerned with idmapped mounts at all. As was discussed upstream it's time to rename it to something that reflects its generic nature. So rename it from idmapped-mounts to vfs. [Zorro: fix generic/689 and add it into idmapped test group] Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2022-04-17fstests: test dirty pipe vulnerability issue of CVE-2022-0847Zorro Lang
Test for the Dirty Pipe vulnerability (CVE-2022-0847) caused by an uninitialized "pipe_buffer.flags" variable. The bug cause a file can be overwritten even if a user/process is not permitted to write it. It's fixed by 9d2231c5d74e ("lib/iov_iter: initialize "flags" in new pipe_buffer"). Cc: Max Kellermann <max.kellermann@ionos.com> Signed-off-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2022-04-10generic: read multiple extents with io_uringFilipe Manana
Test doing a read, with io_uring, over a file range that includes multiple extents. The read operation triggers page faults when accessing all pages of the read buffer except for the pages corresponding to the first extent. We want to check that the operation results in reading all the extents and that it returns the correct data. This is motivated by an issue found with MariaDB when using io_uring and running on btrfs. There's a patch for btrfs to address the issue ca93e44bfb5f ("btrfs: fallback to blocking mode when doing async dio over multiple extents") Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2022-03-21generic: Add test for seekdirJan Kara
Add test checking functionality of seekdir. We check whether seekdir gets us back to the directory entry it should and also whether seeking to random positions does not crash the filesystem. Unlike test generic/310 which also tests seeking, this test checks both glibc readdir() function as well as getdents64() syscall directly. This is because glibc readdir() implementation does a lot of caching and processing internally thus hiding kernel from some possible problems. Also test wider range of random offsets to have better chance of hitting out of bound accesses or other bugs. This is a regression test for a48fc69fe658 ("udf: Fix crash after seekdir") Signed-off-by: Jan Kara <jack@suse.cz> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2022-01-16xfs: regression test for allocsp handing out stale disk contentsDarrick J. Wong
Add a regression test to check that XFS_IOC_ALLOCSP isn't handing out stale disk blocks for preallocation. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-12-25ext4/033: test EXT4_IOC_RESIZE_FS by calling the ioctl directlyTheodore Ts'o
E2fsprogs commits 4ea80d031c7e ("resize2fs: adjust new size of the file system to allow a successful resize") and 50088b1996cc ("resize2fs: attempt to keep the # of inodes valid by removing the last bg") will automatically reduce the requested new size of the file system by up to a single block group to avoid overflowing the 32-bit inode count. This interferes with ext4/033's test of kernel commit 4f2f76f75143 ("ext4: Forbid overflowing inode count when # resizing".) Address this by creating a new test program, ext4_resize which calls the EXT4_IOC_RESIZE_FS ioctl directly so we can correctly test the kernel's online resize code. Reported-by: Eric Whitney <enwlinux@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-08-29generic: Test page faults during read and writeAndreas Gruenbacher
Some filesystems have problems when the buffer passed to read or write is memory-mapped to the file being read from or written to, and the buffer needs to be faulted in during the read or write. That's not common, but filesystems are still required to cope with it, and if they fail this test, then they will also fail more complex scenarios that involve multiple files. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-06-27fstests: automatically generate group filesDarrick J. Wong
Now that we've moved the group membership details into the test case files themselves, automatically generate the group files during build. The autogenerated files are named "group.list" instead of "group" to avoid conflicts between generated and (stale) SCM files as everyone rebases. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-06-13ext4: test journal checkpoint ioctlLeah Rumancik
Test for commit "ext4: add ioctl EXT4_IOC_CHECKPOINT". Tests journal checkpointing and journal erasing via EXT4_IOC_CHECKPOINT with flag EXT4_IOC_CHECKPOINT_FLAG_ZEROOUT set. Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-05-30fstests: improved .gitignoreKent Overstreet
Ignore dotfiles, tags, and verifier state. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-05-23generic: mmap and copy file data with page overlappingZorro Lang
Mmap 2 pages of file, write 64 bytes to the first and second pages, copy the data from the first page and then second page to the second page offset with $pagesize - 64. Verify the data at the end. +-----------------------+ | (copy) | | V +---------------+---------------+------------ |AAAA| ........ |AAAA| ... |AAAA|AAAA| +---------------+---------------+------------ | ^ | (copy) | +------------+ This's also a regression test cover kernel commit: 4f06dd92b5d0 ("fuse: fix write deadlock") Signed-off-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-04-18common/rc: add _scratch_{u}mount_idmapped() helpersChristian Brauner
They will be used in follow-up patches for xfs quota tests but might be useful for other tests in the future. Cc: Eryu Guan <guan@eryu.me> Cc: Christoph Hellwig <hch@lst.de> Cc: David Howells <dhowells@redhat.com> Cc: fstests@vger.kernel.org Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-04-18generic: add fstests for idmapped mountsChristian Brauner
Add a test suite to verify the behavior of idmapped mounts. The test suite also includes a range of vfs tests to verify that no regressions are introduced by idmapped mounts. The following tests are currently available with more to come in the future: 01. posix acls on regular and idmapped mounts 02. create operations in user namespace 03. device node creation in user namespace 04. expected ownership on idmapped mounts 05. fscaps on regular mounts 06. fscaps on idmapped mounts 07. fscaps on idmapped mounts in user namespace 08. fscaps on idmapped mounts in user namespace with different id mappings 09. mapped fsids 10. unmapped fsids 11. cross mount hardlink 12. cross idmapped mount hardlink 13. hardlinks from idmapped mounts 14. hardlinks from idmapped mounts in user namespace 15. io_uring 16. io_uring in user namespace 17. io_uring from idmapped mounts 18. io_uring from idmapped mounts in user namespace 19. io_uring from idmapped mounts with unmapped ids 20. io_uring from idmapped mounts with unmapped ids in user namespace 21. following protected symlinks on regular mounts 22. following protected symlinks on idmapped mounts 23. following protected symlinks on idmapped mounts in user namespace 24. cross mount rename 25. cross idmapped mount rename 26. rename from idmapped mounts 27. rename from idmapped mounts in user namespace 28. symlink from regular mounts 29. symlink from idmapped mounts 30. symlink from idmapped mounts in user namespace 31. setid binaries on regular mounts 32. setid binaries on idmapped mounts 33. setid binaries on idmapped mounts in user namespace 34. setid binaries on idmapped mounts in user namespace with different id mappings 35. sticky bit unlink operations on regular mounts 36. sticky bit unlink operations on idmapped mounts 37. sticky bit unlink operations on idmapped mounts in user namespace 38. sticky bit rename operations on regular mounts 39. sticky bit rename operations on idmapped mounts 40. sticky bit rename operations on idmapped mounts in user namespace 41. create operations in directories with setgid bit set 42. create operations in directories with setgid bit set on idmapped mounts 43. create operations in directories with setgid bit set on idmapped mounts in user namespace 44. verify create operations and ownership with racing threads idmapping a mount 45. setattr truncate operations on regular mounts 46. setattr truncate operations on idmapped mounts 47. setattr truncate operations on idmapped mounts in user namespace Here's some sample output when running with DEBUG_TRACE defined: Cc: Amir Goldstein <amir73il@gmail.com> Cc: Eryu Guan <guan@eryu.me> Cc: fstests@vger.kernel.org Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-04-18generic: add test for detached mount propagationChristian Brauner
Regression test to verify that creating a series of detached mounts, attaching them to the filesystem, and unmounting them does not trigger an integer overflow in ns->mounts causing the kernel to block any new mounts in count_mounts() and returning ENOSPC because it falsely assumes that the maximum number of mounts in the mount namespace has been reached, i.e. it thinks it can't fit the new mounts into the mount namespace anymore. The test is written in a way that it will leave the host's mount namespace intact so we are sure to never make the host's mount namespace unuseable! Link: https://git.kernel.org/torvalds/c/ee2e3f50629f17b0752b55b2566c15ce8dafb557 Cc: Eryu Guan <guan@eryu.me> Cc: David Howells <dhowells@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-03-15xfs: test delalloc quota leak when chprojid failsDarrick J. Wong
This is a regression test for a bug in the XFS implementation of FSSETXATTR. When we try to change a file's project id, the quota reservation code will update the incore quota reservations for delayed allocation blocks. Unfortunately, it does this before we finish validating all the FSSETXATTR parameters, which means that if we decide to bail out, we also fail to undo the incore changes. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-03-15generic: test file writers racing with FIDEDUPERANGEDarrick J. Wong
Create a test to make sure that dedupe actually locks the file ranges correctly before starting the content comparison and keeps them locked until the operation completes. [Eryu: added .gitignore entry, required "deduperace" binary in test] Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-03-14fstests: remove DMAPI testsDarrick J. Wong
Upstream XFS has never supported DMAPI, so remove the tests for this feature. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-01-10src/dmiperf: Remove obsolete dmiperfXiao Yang
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2020-12-06generic: ENOSPC regression test in a multi-threaded scenarioPratik Rajesh Sampat
Test allocation strategies of the file system and validate space anomalies as reported by the system versus the allocated by the program. The test is motivated by a bug in ext4 systems where-in ENOSPC is reported by the file system even though enough space for allocations is available[1]. [1]: https://patchwork.ozlabs.org/patch/1294003 Linux kernel patch series that fixes the above regression: 53f86b170dfa ("ext4: mballoc: add blocks to PA list under same spinlock after allocating blocks") cf5e2ca6c990 ("ext4: mballoc: refactor ext4_mb_discard_preallocations()") 07b5b8e1ac40 ("ext4: mballoc: introduce pcpu seqcnt for freeing PA to improve ENOSPC handling") 8ef123fe02ca ("ext4: mballoc: refactor ext4_mb_good_group()") 993778306e79 ("ext4: mballoc: use lock for checking free blocks while retrying") Suggested-by: Ritesh Harjani <riteshh@linux.ibm.com> Co-authored-by: Sourabh Jain <sourabhjain@linux.ibm.com> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com> Signed-off-by: Pratik Rajesh Sampat <psampat@linux.ibm.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2020-03-06fstests: transport two ext4 tests from LTPYong Sun
Recently LTP upstream removed some ext4 tests[1]. And two of them is still valid to keep. So I transport those two tests here. ext4-nsec-timestamps, which is used to test nanosec timestamps of ext4, rewrite into ext4/043 and 044. ext4-subdir-limit, which is used to test subdirectory limit of ext4, rewrite into ext4/045. [1] https://marc.info/?l=linux-fsdevel&m=157190623919681&w=2 Signed-off-by: Sun Yong <yosun@suse.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2020-03-01fstests: remove generic/484Christoph Hellwig
Generic/484 tests functionality that isn't really related to file systems, and has failed every since it was added. Remove it as it serves no puropse in xfstests. [Eryu: also remove src/t_locks_execve.c and its entries in src/Makefile and .gitignore] Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2019-12-09generic: test splice() with pipesDarrick J. Wong
Andreas Grünbacher reports that on the two filesystems that support iomap directio, it's possible for splice() to return -EAGAIN (instead of a short splice) if the pipe being written to has less space available in its pipe buffers than the length supplied by the calling process. This is a regression test to check for correct operation. Kernel needs commit 3253d9d09337 ("splice: only read in as much information as there is pipe buffer space") to pass. 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>
2019-12-01generic: test race between appending AIO DIO and fallocateDarrick J. Wong
Dave Chinner reports[1] that an appending AIO DIO write to the second block of a zero-length file and an fallocate request to the first block of the same file can race to set isize, with the user-visible end result that the file size is set incorrectly to one block long. Write a small test to reproduce the results. [1] https://lore.kernel.org/linux-xfs/20191029100342.GA41131@bfoster/T/ 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>
2019-11-10generic/050: Fix test failure for filesystems without journalJan Kara
Filesystems without journal can happily mount unrecovered filesystem read-only which confuses this test. Handle this by providing different expected output for filesystems without journal. Signed-off-by: Jan Kara <jack@suse.cz> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2019-10-20generic/035: Create new outfile for NFSAnna Schumaker
Rename-overwrites over NFS work with a "silly rename" over the network, so the nlink count stays at 1 instead of dropping to 0. This is expected behavior for NFS, so we should use a different golden output file to account for this. See the NFS faq at: nfs.sourceforge.net/#faq_d2 for more information about silly renames. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2019-10-13generic: check reflink multiple mmap writeDarrick J. Wong
Add a test to make sure that we can handle multiple memory mappings to a physical storage extent shared by multiple files, and that we can handle the copy on write operation without error. Make sure we can also handle mappings at different offsets in the page cache. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2019-08-04xfs: test new v5 bulkstat commandsDarrick J. Wong
Check that the new v5 bulkstat commands do everything the old one do, and then make sure the new functionality actually works. 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>
2019-05-27fscrypt-crypt-util: add utility for reproducing fscrypt encrypted dataEric Biggers
Add a utility program that can reproduce encrypted contents and filenames. It implements all encryption algorithms currently supported by fscrypt (a.k.a. ext4, f2fs, and ubifs encryption), and it generates IVs in the same way. The program takes the algorithm and master key on the command line, and encrypts stdin to stdout. A file nonce may also be passed on the command line, and the program will "tweak" the encryption using this nonce in the same way the kernel does -- either by deriving a subkey, or by including the nonce in the IVs. The block size and padding amount may also be specified. No dependencies are added, as all algorithms implemented from scratch. Signed-off-by: Eric Biggers <ebiggers@google.com>
2019-04-06generic: unaligned direct AIO write testZorro Lang
A simply reproducer from Frank Sorenson: ftruncate(fd, 65012224) io_prep_pwrite(iocbs[0], fd, buf[0], 1048576, 63963648); io_prep_pwrite(iocbs[1], fd, buf[1], 1048576, 65012224); io_submit(io_ctx, 1, &iocbs[0]); io_submit(io_ctx, 1, &iocbs[1]); io_getevents(io_ctx, 2, 2, events, NULL) help to find an ext4 corruption: **************** **************** **************** * page 1 * * page 2 * * page 3 * **************** **************** **************** existing 0000000000000000 0000000000000000 0000000000000000 write 1 AAAAAAAAAAAAAA AA write 2 BBBBBBBBBBBBBB BB result 00AAAAAAAAAAAAAA 00BBBBBBBBBBBBBB BB00000000000000 desired 00AAAAAAAAAAAAAA AABBBBBBBBBBBBBB BB00000000000000 This issue remind us we might miss unaligned AIO test for long time. We thought fsx cover this part, but looks like it's not. So this case trys to cover unaligned direct AIO write test on file with different initial truncate i_size. The following patches fix the issue on xfs and ext4. xfs: serialize unaligned dio writes against all other dio writes ext4: Fix data corruption caused by unaligned direct AIO Signed-off-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2019-02-16generic: check the behavior of programs opening a lot of O_TMPFILE filesDarrick J. Wong
Create a test (+ helper program) that opens as many unlinked files as it possibly can on the scratch filesystem, then closes all the files at once to stress-test unlinked file cleanup. Add an xfs-specific test to make sure that the fallback code doesn't bitrot. 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>
2019-02-16generic: posix acl extended attribute memory corruption testDarrick J. Wong
XFS had a use-after-free bug when xfs_xattr_put_listent runs out of listxattr buffer space while trying to store the name "system.posix_acl_access" and then corrupts memory by not checking the seen_enough state and then trying to shove "trusted.SGI_ACL_FILE" into the buffer as well. In order to tickle the bug in a user visible way we must have already put a name in the buffer, so we take advantage of the fact that "security.evm" sorts before "system.posix_acl_access" to make sure this happens. 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-07-29generic: test DAX DMA vs truncate/hole-punchRoss Zwisler
This adds a regression test for the following series: [PATCH v4 0/2] ext4: fix DAX dma vs truncate/hole-punch https://lists.01.org/pipermail/linux-nvdimm/2018-July/016842.html which adds synchronization between DAX DMA in ext4 and truncate/hole-punch. The intention of the test is to test those specific changes, but it runs fine both with XFS and without DAX so I've put it in the generic tests instead of ext4 and not restricted it to only DAX configurations. When run with v4.18-rc6 + DAX + ext4, this test will hit the following WARN_ON_ONCE() in dax_disassociate_entry(): WARN_ON_ONCE(trunc && page_ref_count(page) > 1); If you change this to a WARN_ON() instead, you can see that each of the four paths being exercised in this test hits that condition many times in the one second that the subtest is being run. Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-23generic: test invalid swap file activationOmar Sandoval
Swap files cannot have holes, and they must at least two pages. swapon(8) and mkswap(8) have stricter restrictions, so add versions of those commands without any restrictions. Signed-off-by: Omar Sandoval <osandov@fb.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-02generic: test XATTR_REPLACE doesn't take the fs downDarrick J. Wong
Kanda Motohiro reported that expanding a tiny xattr into a large xattr fails on XFS because we remove the tiny xattr from a shortform fork and then try to re-add it after converting the fork to extents format having not removed the ATTR_REPLACE flag. This fails because the attr is no longer present, causing a fs shutdown. [Eryu: introduce function "fail" and use it where appropriate] Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199119 Reported-by: kanda.motohiro@gmail.com 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-27generic: test record locks across execve in multithread processXiong Zhou
POSIX requires that record locks are preserved across an execve(2). But currently the locks are released if process is multithreaded at the time that execve is called. As Jeff Layton wrote in his patch: " In that case, we'll end up unsharing the files_struct but the locks will still have their fl_owner set to the address of the old one. Eventually, when the other threads die and the last reference to the old files_struct is put, any POSIX locks get torn down since it looks like a close occurred on them. The result is that all of your open files will be intact with none of the locks you held before execve. " Add a new regression test for this particular case. [Eryu: rewrite commit log and test description] Signed-off-by: Xiong Zhou <xzhou@redhat.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-02-16generic: add OFD lock testsXiong Zhou
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-01-06ext4: test for inline data + DAX corruptionRoss Zwisler
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 Zwisler
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>
2017-11-26fstests: add fio perf results supportJosef Bacik
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-10-11generic: test race when checking i_size on direct i/o readZheng Liu
In this commit a new test case is added to test that i_size races don't occur under dio reads/writes. We add a program in /src dir, which has a writer to issue some append dio writes. Meanwhile it has a reader in this test to do some dio reads. As we expect, reader should read nothing or data with 'a'. But it might read some data with '0'. The bug can be reproduced by this test case [1]. 1. http://patchwork.ozlabs.org/patch/311761/ This ostensibly tests commit: 9fe55eea7 Fix race when checking i_size on direct i/o read Update by Eric Sandeen: - update to recent xfstests - update commit log Update by Eryu Guan: - add aio-dio support to the test and add 'aio' group - add ability to test different alignments - move test from src/ to src/aio-dio-regress/ - add .gitignore entry - rebase against latest xfstests with various minor fixes & cleanups - update commit log Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-10-09generic: add a new test for racing AIO COW writesChristoph Hellwig
This can be used to trigger an assert in the current XFS code because it can't handle the case where there are COW extents on a file, but none at or below the range converted by the AIO completion handler. Note that it doesn't trigger the assert 100% but fairly reliably. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-09-30generic: mmap write readonly DAX fileXiong Zhou
Regression case that one can write to read-only file in a DAX mountpoint. Signed-off-by: Xiong Zhou <xzhou@redhat.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-09-30gitignore: sort src/ binaries nameXiong Zhou
Signed-off-by: Xiong Zhou <xzhou@redhat.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-09-13gitignore: ignore cscope filesRoss Zwisler
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>