aboutsummaryrefslogtreecommitdiff
path: root/tests/sys/fs
Commit message (Collapse)AuthorAgeFilesLines
...
* fusefs: prefer new/delete over malloc/freeAlan Somers2024-01-177-109/+85
| | | | | | MFC after: 2 weeks Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D43464
* fusefs: more consistent operand ordering in io.ccAlan Somers2024-01-151-27/+27
| | | | MFC after: 2 weeks
* fusefs: fix an interaction between copy_file_range and mmapAlan Somers2024-01-152-5/+153
| | | | | | | | | If a copy_file_range operation tries to read from a page that was previously written via mmap, that page must be flushed first. MFC after: 2 weeks Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D43451
* Add a regression test for PR 276191.Alan Somers2024-01-131-0/+10
| | | | | | | | | | | The bug isn't fusefs-specific, but this is the easiest way to reproduce it. PR: 276191 MFC after: 1 week MFC with: bdb46c21a3e68d4395d6e0b6a205187e655532b0 Differential Revision: https://reviews.freebsd.org/D43446 Reviewed by: kib
* Silence VLA extension warnings in fusefs testsDimitry Andric2023-12-211-0/+4
| | | | | | | | | | | | | | Building tests/sys/fs/fusefs with clang 18 results the following warning: tests/sys/fs/fusefs/cache.cc:145:14: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] 145 | uint8_t buf[bufsize]; | ^~~~~~~ Because we do not particularly care that this is a clang extension, suppress the warning. MFC after: 3 days
* fusefs: sanitize FUSE_READLINK results for embedded NULsAlan Somers2023-10-071-0/+39
| | | | | | | | | | | | If VOP_READLINK returns a path that contains a NUL, it will trigger an assertion in vfs_lookup. Sanitize such paths in fusefs, rejecting any and warning the user about the misbehaving server. PR: 274268 MFC after: 1 week Sponsored by: Axcient Reviewed by: mjg, markj Differential Revision: https://reviews.freebsd.org/D42081
* Fix intermittency in the sys.fs.fusefs.symlink.main testAlan Somers2023-10-062-1/+8
| | | | | | | | | | | | | This change is identical to 86885b18689 but for symlink instead of mknod. The kernel sends a FUSE_FORGET asynchronously with the final syscall. The lack of an expectation caused this test to occasionally fail. Also, remove a sleep that accidentally snuck into a different test. MFC after: 2 weeks MFC with: 86885b18689889e9b9142fd31d8c67f21334ba32 Sponsored by: Axcient
* Fix intermittency in the sys.fs.fusefs.mknod.main testAlan Somers2023-10-061-0/+7
| | | | | | | | | | | | | | In the Mknod.parent_inode test case, the kernel sends an extra FUSE_FORGET message. But because it gets sent asynchronously with the failing syscall, it doesn't always get received before the test ends. So we never setup an expectation for it. And 90+% of the time the test would exit successfully. Fix the intermittency by always waiting to receive the FUSE_FORGET message. MFC after: 2 weeks Sponsored by: Axcient
* fusefs: add more readdir tests for misbehaving serversAlan Somers2023-10-051-0/+87
| | | | | | | Inspired by PR 274268 MFC after: 2 weeks Sponsored by: Axcient
* fusefs: fix unused variables from fb619c94c67Alan Somers2023-09-212-3/+0
| | | | | | | | PR: 270749 Reported by: cy MFC after: 1 week MFC with: fb619c94c679e939496fe0cf94b8d2cba95e6e63 Sponsored by: Axcient
* fusefs: fix some bugs updating atime during closeAlan Somers2023-09-213-2/+127
| | | | | | | | | | | | | | | | | When using cached attributes, we must update a file's atime during close, if it has been read since the last attribute refresh. But, * Don't update atime if we lack write permissions to the file or if the file system is readonly. * If the daemon fails our atime update request for any reason, don't report this as a failure for VOP_CLOSE. PR: 270749 Reported by: Jamie Landeg-Jones <jamie@catflap.org> MFC after: 1 week Sponsored by: Axcient Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D41925
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-166-6/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-1649-98/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* fusefs tests: handle -Wdeprecated* issues with GoogleTest 1.14.0Enji Cooper2023-08-109-16/+16
| | | | | | | | | | | | | `INSTANTIATE_TEST_CASE_P` has been replaced with `INSTANTIATE_TEST_SUITE_P`. Replace all uses of the former macro with the latter macro. While here, address the fact that the latter macro doesn't permit some of the constructions that the former macro did, e.g., empty parameters, etc. MFC after: 2 weeks Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D41398
* tests/fusefs: Suppress false warning from GCC.John Baldwin2023-06-201-1/+3
| | | | | | | | | GCC complains that DNAME in the inval_entry_below_root test is not used, but EXPECT_LOOKUP() does pass DNAME to strcmp in an internal lambda function. Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D40661
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-1248-48/+48
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* makefs: add missing break for 'g' case in tarfs testEd Maste2023-03-231-0/+1
| | | | | | | Reported by: Coverity Scan CID: 1506954 Fixes: 6cb78fa479c7 ("tarfs: Repeat tests using GNU tar if available.") Sponsored by: The FreeBSD Foundation
* tarfs: Fix backtracking during node creation.Dag-Erling Smørgrav2023-03-162-13/+9
| | | | | | | Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D39082
* tarfs: Support tar files which include file modes with permissions.Dag-Erling Smørgrav2023-03-161-0/+1
| | | | | | | Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D39020
* tarfs: Correctly track link count.Dag-Erling Smørgrav2023-03-161-0/+2
| | | | | | | Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D39019
* tarfs: Repeat tests using GNU tar if available.Dag-Erling Smørgrav2023-03-162-13/+104
| | | | | | | Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Reviewed by: ngie, asomers Differential Revision: https://reviews.freebsd.org/D39018
* tarfs: Set mountedfrom correctly.Dag-Erling Smørgrav2023-03-071-2/+4
| | | | | | | Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Reviewed by: sjg, kib Differential Revision: https://reviews.freebsd.org/D38930
* testing: skip tarfs tests if module is not loadable.Olivier Cochard2023-03-011-1/+6
| | | | | | Approved by: asomers Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D38828
* fusefs: add some more test cases for bad fuse serversAlan Somers2023-02-225-9/+112
| | | | | | | MFC after: 1 week Sponsored by: Axcient Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D38719
* fusefs: fix a buffer overflow in the testsAlan Somers2023-02-227-1/+18
| | | | | | | | | | The actual overflow occured in the ReadAhead.readahead test. Surprisingly it has never segfaulted or resulted in any bad behavior. MFC after: 1 week Sponsored by: Axcient Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D38718
* tarfs: Really prevent descending into a non-directory.Dag-Erling Smørgrav2023-02-201-12/+75
| | | | | | | | | | | The previous fix was incorrect: we need to verify that the current node, if it exists, is not a directory, but we were checking the parent node instead. Address this, add more tests, and fix the test cleanup routines. PR: 269519, 269561 Fixes: ae6cff89738b Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D38645
* tarfs: Don't panic if the parent of a new node is not a directory.Dag-Erling Smørgrav2023-02-151-4/+26
| | | | | | | | PR: 269519 Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D38587
* tarfs: Fix issues revealed by static analysis and testing.Dag-Erling Smørgrav2023-02-091-3/+40
| | | | | | | | | | | | | | | | | | * tarfs_alloc_mount(): Remove an unnecessary null check (CID 1504505) and an unused variable. * tarfs_alloc_one(): Verify that the file size is not negative (CID 1504506). While there, also validate the mode, owner and group. * tarfs_vget(), tarfs_zio_init(): Explicitly ignore return value from getnewvnode(), which cannot fail (CID 1504508) * tarfs_lookup_path(): Fix a case where a specially-crafted tarball could trigger a null pointer dereference by first descending into, and then backing out of, a previously unknown directory. (CID 1504515) * mktar: Construct a tarball that triggers the aforementioned null pointer dereference. Reported by: Coverity Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Reviewed by: imp, kib Differential Revision: https://reviews.freebsd.org/D38463
* Add tarfs, a filesystem backed by tarballs.Dag-Erling Smørgrav2023-02-024-0/+303
| | | | | | | Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Reviewed by: pauamma, imp Differential Revision: https://reviews.freebsd.org/D37753
* fusefs: fix VOP_ADVLOCK with SEEK_ENDAlan Somers2022-10-192-1/+135
| | | | | | | | | | | When the user specifies SEEK_END, unlike SEEK_CUR, VOP_ADVLOCK must adjust lock offsets itself. Sort-of related to bug 266886. MFC after: 2 weeks Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D37040
* fusefs: After successful F_GETLK, l_whence should be SEEK_SETAlan Somers2022-10-171-2/+67
| | | | | | | | PR: 266886 Reported by: John Millikin <jmillikin@gmail.com> MFC after: 2 weeks Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D37014
* fusefs: during F_GETLK, don't change l_pid if no lock is foundAlan Somers2022-10-071-2/+14
| | | | | | | | | PR: 266885 MFC after: 2 weeks Submitted by: John Millikin <jmillikin@gmail.com> Sponsored by: Axcient Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D36905
* copy_file_range: truncate write if it would exceed RLIMIT_FSIZEAlan Somers2022-09-261-25/+88
| | | | | | | PR: 266611 MFC after: 2 weeks Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D36706
* fusefs: truncate write if it would exceed RLIMIT_FSIZEAlan Somers2022-09-251-10/+68
| | | | | | | PR: 164793 MFC after: 2 weeks Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D36703
* fusefs: respect RLIMIT_FSIZE during truncateAlan Somers2022-09-251-1/+43
| | | | | | | PR: 164793 MFC after: 2 weeks Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D36703
* tests/sys/fs: remove mips workaroundMitchell Horne2022-09-151-5/+0
| | | | | | | MIPS is gone, so we no longer require this check. Reviewed by: imp, asomers Differential Revision: https://reviews.freebsd.org/D36566
* fusefs tests: Remove an unused variable.Dmitry Chagin2022-05-131-2/+1
| | | | | | Reviewed by: asomers Differential revision: https://reviews.freebsd.org/D35185 MFC after: 2 weeks
* fusefs: handle evil servers that return illegal inode numbersAlan Somers2022-05-126-0/+226
| | | | | | | | | | | | | | | | | | | | * If during FUSE_CREATE, FUSE_MKDIR, etc the server returns the same inode number for the new file as for its parent directory, reject it. Previously this would triggers a recurse-on-non-recursive lock panic. * If during FUSE_LINK the server returns a different inode number for the new name as for the old one, reject it. Obviously, that can't be a hard link. * If during FUSE_LOOKUP the server returns the same inode number for the new file as for its parent directory, reject it. Nothing good can come of this. PR: 263662 Reported by: Robert Morris <rtm@lcs.mit.edu> MFC after: 2 weeks Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D35128
* fusefs: make the mknod.cc tests a bit more general.Alan Somers2022-05-121-25/+60
| | | | | MFC after: 2 weeks Reviewed by: pfg
* fusefs: annotate more file descriptor leaks in the testsAlan Somers2022-05-056-0/+36
| | | | | | | | | The fusefs tests intentionally leak file descriptors. Annotate all of the leakages in order to hopefully pacify Coverity. Reported by: Coverity (20 different CIDs) MFC after: 2 weeks Sponsored by: Axcient
* fusefs: use the fsname mount option if setAlan Somers2022-04-295-4/+28
| | | | | | | | | | The daemon can specify fsname=XXX in its mount options. If so, the file system should report f_mntfromname as XXX during statfs. This will show up in the output of commands like mount and df. Submitted by: Ali Abdallah <ali.abdallah@suse.com> MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35090
* fusefs: add a test for the subtype= optionAlan Somers2022-04-295-5/+42
| | | | | | | | | At mount time server can set, for example, "subtype=xfs", so that mount(8) will later show the mountpoint's file system as "fusefs.xfs". fusefs has had this feature ever since the original GSoC commit in 2012, but there's never been a test for it. MFC after: 2 weeks
* fusefs: fix FUSE_CREATE with file handles and fuse protocol < 7.9Alan Somers2022-04-281-5/+8
| | | | | | | | | | | | Prior to fuse protocol version 7.9, the fuse_entry_out structure had a smaller size. But fuse_vnop_create did not take that into account when working with servers that use older protocols. The bug does not matter for servers which don't use file handles or open flags (the only fields affected). PR: 263625 Submitted by: Ali Abdallah <ali.abdallah@suse.com> MFC after: 2 weeks
* fusefs: correctly handle servers that report too much data writtenAlan Somers2022-04-191-0/+61
| | | | | | | | | | | | | | | | | | | | | During a FUSE_WRITE, the kernel requests the server to write a certain amount of data, and the server responds with the amount that it actually did write. It is obviously an error for the server to write more than it was provided, and we always treated it as such, but there were two problems: * If the server responded with a huge amount, greater than INT_MAX, it would trigger an integer overflow which would cause a panic. * When extending the file, we wrongly set the file's size before validing the amount written. PR: 263263 Reported by: Robert Morris <rtm@lcs.mit.edu> MFC after: 2 weeks Sponsored by: Axcient Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D34955
* fusefs: validate servers' error valuesAlan Somers2022-04-154-2/+33
| | | | | | | | | | | | | | | | | Formerly fusefs would pass up the stack any error value returned by the fuse server. However, some values aren't valid for userland, but have special meanings within the kernel. One of these, EJUSTRETURN, could cause a kernel page fault if the server returned it in response to FUSE_LOOKUP. Fix by validating all errors returned by the server. Also, fix a data lifetime bug in the FUSE_DESTROY test. PR: 263220 Reported by: Robert Morris <rtm@lcs.mit.edu> MFC after: 3 weeks Sponsored by: Axcient Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D34931
* fusefs: fix two bugs regarding VOP_RECLAIM of the root inodeAlan Somers2022-04-064-4/+33
| | | | | | | | | | | | | | | | * We never send FUSE_LOOKUP for the root inode, since its inode number is hard-coded to 1. Therefore, we should not send FUSE_FORGET for it, lest the server see its lookup count fall below 0. * During VOP_RECLAIM, if we are reclaiming the root inode, we must clear the file system's vroot pointer. Otherwise it will be left pointing at a reclaimed vnode, which will cause future VOP_LOOKUP operations to fail. Previously we only cleared that pointer during VFS_UMOUNT. I don't know of any real-world way to trigger this bug. MFC after: 2 weeks Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D34753
* fusefs: fix a cached attributes bug during directory renameAlan Somers2022-02-241-2/+36
| | | | | | | | | | When renaming a directory into a different parent directory, invalidate the cached attributes of the new parent. Otherwise, stat will show the wrong st_nlink value. MFC after: 1 week Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D34336
* [skip ci] fusefs: delete a stray comment from 91972cfcddfAlan Somers2022-02-121-1/+0
| | | | MFC after: 3 days
* Explicitly include semaphore.h for struct _sem in fusefs setattr testDimitry Andric2022-02-061-0/+1
| | | | | | | | | | | | | | | In libc++'s __threading_support header the semaphore.h header was implicitly included, but from version 14 onwards, this is no longer the case, resulting in compile errors: tests/sys/fs/fusefs/setattr.cc:740:8: error: variable has incomplete type 'sem_t' (aka '_sem') sem_t sem; ^ tests/sys/fs/fusefs/utils.hh:33:8: note: forward declaration of '_sem' struct _sem; ^ MFC after: 3 days
* fusefs: implement VOP_DEALLOCATEAlan Somers2022-01-192-15/+543
| | | | | | MFC after: Never Reviewed by: khng Differential Revision: https://reviews.freebsd.org/D33800