| #
7e68af7c
|
| 23-Jan-2026 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: redo vnode attribute locking
Previously most fields in fuse_vnode_data were protected by the vnode lock. But because DEBUG_VFS_LOCKS was never enabled by default until stable/15 the asserti
fusefs: redo vnode attribute locking
Previously most fields in fuse_vnode_data were protected by the vnode lock. But because DEBUG_VFS_LOCKS was never enabled by default until stable/15 the assertions were never checked, and many were wrong. Others were missing. This led to panics in stable/15 and 16.0-CURRENT, when a vnode was expected to be exclusively locked but wasn't, for fuse file systems that mount with "-o async".
In some places it isn't possible to exclusively lock the vnode when accessing these fields. So protect them with a new mutex instead. This fixes panics and unprotected field accesses in VOP_READ, VOP_COPY_FILE_RANGE, VOP_GETATTR, VOP_BMAP, and FUSE_NOTIFY_INVAL_ENTRY. Add assertions everywhere the protected fields are accessed.
Lock the vnode exclusively when handling FUSE_NOTIFY_INVAL_INODE.
During fuse_vnode_setsize, if the vnode isn't already exclusively locked, use the vn_delayed_setsize mechanism. This fixes panics during VOP_READ or VOP_GETATTR.
Also, ensure that fuse_vnop_rename locks the "from" vnode.
Finally, reorder elements in struct fuse_vnode_data to reduce the structure size.
Fixes: 283391 Reported by: kargl, markj, vishwin, Abdelkader Boudih, groenveld@acm.org MFC after: 2 weeks Sponsored by: ConnectWise Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D55230
show more ...
|
| #
95ee2897
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
| #
ba8cc6d7
|
| 12-Mar-2023 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: use __enum_uint8 for vtype and vstate
This whacks hackery around only reading v_type once.
Bump __FreeBSD_version to 1400093
|
| #
13d593a5
|
| 29-Nov-2021 |
Alan Somers <asomers@FreeBSD.org> |
Fix a race in fusefs that can corrupt a file's size.
VOPs like VOP_SETATTR can change a file's size, with the vnode exclusively locked. But VOPs like VOP_LOOKUP look up the file size from the serve
Fix a race in fusefs that can corrupt a file's size.
VOPs like VOP_SETATTR can change a file's size, with the vnode exclusively locked. But VOPs like VOP_LOOKUP look up the file size from the server without the vnode locked. So a race is possible. For example:
1) One thread calls VOP_SETATTR to truncate a file. It locks the vnode and sends FUSE_SETATTR to the server. 2) A second thread calls VOP_LOOKUP and fetches the file's attributes from the server. Then it blocks trying to acquire the vnode lock. 3) FUSE_SETATTR returns and the first thread releases the vnode lock. 4) The second thread acquires the vnode lock and caches the file's attributes, which are now out-of-date.
Fix this race by recording a timestamp in the vnode of the last time that its filesize was modified. Check that timestamp during VOP_LOOKUP and VFS_VGET. If it's newer than the time at which FUSE_LOOKUP was issued to the server, ignore the attributes returned by FUSE_LOOKUP.
PR: 259071 Reported by: Agata <chogata@moosefs.pro> Reviewed by: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D33158
show more ...
|
| #
91972cfc
|
| 29-Nov-2021 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: update atime on reads when using cached attributes
When using cached attributes, whether or not the data cache is enabled, fusefs must update a file's atime whenever it reads from it, so lon
fusefs: update atime on reads when using cached attributes
When using cached attributes, whether or not the data cache is enabled, fusefs must update a file's atime whenever it reads from it, so long as it wasn't mounted with -o noatime. Update it in-kernel, and flush it to the server on close or during the next setattr operation.
The downside is that close() will now frequently trigger a FUSE_SETATTR upcall. But if you care about performance, you should be using -o noatime anyway.
MFC after: 2 weeks Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D33145
show more ...
|
| #
5d94aaac
|
| 03-Oct-2021 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: quiet some cache-related warnings
If the FUSE server does something that would make our cache incoherent, we should print a warning to the user. However, we previously warned in some situat
fusefs: quiet some cache-related warnings
If the FUSE server does something that would make our cache incoherent, we should print a warning to the user. However, we previously warned in some situations when we shouldn't, such as if the file's size changed on the server _after_ our own attribute cache had expired. This change suppresses the warning in cases like that. It also moves the warning logic to a single place within the code.
PR: 256936 Reported by: Agata <chogata@moosefs.pro> Tested by: Agata <chogata@moosefs.pro>, jSML4ThWwBID69YC@protonmail.com MFC after: 2 weeks
show more ...
|
| #
2bfd8992
|
| 15-Feb-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
vnode: move write cluster support data to inodes.
The data is only needed by filesystems that 1. use buffer cache 2. utilize clustering write support.
Requested by: mjg Reviewed by: asomers (previo
vnode: move write cluster support data to inodes.
The data is only needed by filesystems that 1. use buffer cache 2. utilize clustering write support.
Requested by: mjg Reviewed by: asomers (previous version), fsu (ext2 parts), mckusick Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28679
show more ...
|
| #
b0ecfb42
|
| 11-Mar-2020 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: avoid cache corruption with buggy fuse servers
The FUSE protocol allows the client (kernel) to cache a file's size, if the server (userspace daemon) allows it. A well-behaved daemon obviousl
fusefs: avoid cache corruption with buggy fuse servers
The FUSE protocol allows the client (kernel) to cache a file's size, if the server (userspace daemon) allows it. A well-behaved daemon obviously should not change a file's size while a client has it cached. But a buggy daemon might. If the kernel ever detects that that has happened, then it should invalidate the entire cache for that file. Previously, we would not only cache stale data, but in the case of a file extension while we had the size cached, we accidentally extended the cache with zeros.
PR: 244178 Reported by: Ben RUBSON <ben.rubson@gmx.com> Reviewed by: cem MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24012
show more ...
|
| #
419f843f
|
| 17-Sep-2019 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r352319 through r352435.
|
| #
42767f76
|
| 16-Sep-2019 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: fix some minor issues with fuse_vnode_setparent
* When unparenting a vnode, actually clear the flag. AFAIK this is basically a no-op because we only unparent a vnode when reclaiming it or
fusefs: fix some minor issues with fuse_vnode_setparent
* When unparenting a vnode, actually clear the flag. AFAIK this is basically a no-op because we only unparent a vnode when reclaiming it or when unlinking.
* There's no need to call fuse_vnode_setparent during reclaim, because we're about to free the vnode data anyway.
Reviewed by: emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21630
show more ...
|
| #
0b4275ac
|
| 07-Aug-2019 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: merge from projects/fuse2
This commit imports the new fusefs driver. It raises the protocol level from 7.8 to 7.23, fixes many bugs, adds a test suite for the driver, and adds many new featu
fusefs: merge from projects/fuse2
This commit imports the new fusefs driver. It raises the protocol level from 7.8 to 7.23, fixes many bugs, adds a test suite for the driver, and adds many new features. New features include:
* Optional kernel-side permissions checks (-o default_permissions) * Implement VOP_MKNOD, VOP_BMAP, and VOP_ADVLOCK * Allow interrupting FUSE operations * Support named pipes and unix-domain sockets in fusefs file systems * Forward UTIME_NOW during utimensat(2) to the daemon * kqueue support for /dev/fuse * Allow updating mounts with "mount -u" * Allow exporting fusefs file systems over NFS * Server-initiated invalidation of the name cache or data cache * Respect RLIMIT_FSIZE * Try to support servers as old as protocol 7.4
Performance enhancements include:
* Implement FUSE's FOPEN_KEEP_CACHE and FUSE_ASYNC_READ flags * Cache file attributes * Cache lookup entries, both positive and negative * Server-selectable cache modes: writethrough, writeback, or uncached * Write clustering * Readahead * Use counter(9) for statistical reporting
PR: 199934 216391 233783 234581 235773 235774 235775 PR: 236226 236231 236236 236291 236329 236381 236405 PR: 236327 236466 236472 236473 236474 236530 236557 PR: 236560 236844 237052 237181 237588 238565 Reviewed by: bcr (man pages) Reviewed by: cem, ngie, rpokala, glebius, kib, bde, emaste (post-commit review on project branch) MFC after: 3 weeks Relnotes: yes Sponsored by: The FreeBSD Foundation Pull Request: https://reviews.freebsd.org/D21110
show more ...
|
| #
8aafc8c3
|
| 28-Jun-2019 |
Alan Somers <asomers@FreeBSD.org> |
[skip ci] update copyright headers in fusefs files
Sponsored by: The FreeBSD Foundation
|
| #
560a55d0
|
| 27-Jun-2019 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: convert statistical sysctls to use counter(9)
counter(9) is more performant than using atomic instructions to update sysctls that just report statistics to userland.
Sponsored by: The FreeB
fusefs: convert statistical sysctls to use counter(9)
counter(9) is more performant than using atomic instructions to update sysctls that just report statistics to userland.
Sponsored by: The FreeBSD Foundation
show more ...
|
| #
788af953
|
| 25-Jun-2019 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: automatically update mtime and ctime on write
Writing should implicitly update a file's mtime and ctime. For fuse, the server is supposed to do that. But the client needs to do it too, bec
fusefs: automatically update mtime and ctime on write
Writing should implicitly update a file's mtime and ctime. For fuse, the server is supposed to do that. But the client needs to do it too, because the FUSE_WRITE response does not include time attributes, and it's not desirable to issue a GETATTR after every WRITE. When using the writeback cache, there's another hitch: the kernel should ignore the mtime and ctime fields in any GETATTR response for files with a dirty write cache.
Sponsored by: The FreeBSD Foundation
show more ...
|
| #
0269ae4c
|
| 06-Jun-2019 |
Alan Somers <asomers@FreeBSD.org> |
MFHead @348740
Sponsored by: The FreeBSD Foundation
|
| #
0d2bf489
|
| 31-May-2019 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: check the vnode cache when looking up files for the NFS server
FUSE allows entries to be cached for a limited amount of time. fusefs's vnop_lookup method already implements that using the t
fusefs: check the vnode cache when looking up files for the NFS server
FUSE allows entries to be cached for a limited amount of time. fusefs's vnop_lookup method already implements that using the timeout functionality of cache_lookup/cache_enter_time. However, lookups for the NFS server go through a separate path: vfs_vget. That path can't use the same timeout functionality because cache_lookup/cache_enter_time only work on pathnames, whereas vfs_vget works by inode number.
This commit adds entry timeout information to the fuse vnode structure, and checks it during vfs_vget. This allows the NFS server to take advantage of cached entries. It's also the same path that FUSE's asynchronous cache invalidation operations will use.
Sponsored by: The FreeBSD Foundation
show more ...
|
| #
65417f5e
|
| 24-May-2019 |
Alan Somers <asomers@FreeBSD.org> |
Remove "struct ucred*" argument from vtruncbuf
vtruncbuf takes a "struct ucred*" argument. AFAICT, it's been unused ever since that function was first added in r34611. Remove it. Also, remove some
Remove "struct ucred*" argument from vtruncbuf
vtruncbuf takes a "struct ucred*" argument. AFAICT, it's been unused ever since that function was first added in r34611. Remove it. Also, remove some "struct ucred" arguments from fuse and nfs functions that were only used by vtruncbuf.
Reviewed by: cem MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20377
show more ...
|
| #
e5b50fe7
|
| 23-May-2019 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: Make fuse file systems NFS-exportable
This commit adds the VOPs needed by userspace NFS servers (tested with net/unfs3). More work is needed to make the in-kernel nfsd work, because of its
fusefs: Make fuse file systems NFS-exportable
This commit adds the VOPs needed by userspace NFS servers (tested with net/unfs3). More work is needed to make the in-kernel nfsd work, because of its stateless nature. It doesn't open files prior to doing I/O. Also, the NFS-related VOPs currently ignore the entry cache.
Sponsored by: The FreeBSD Foundation
show more ...
|
| #
3d15b234
|
| 15-May-2019 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: don't track a file's size in two places
fuse_vnode_data.filesize was mostly redundant with fuse_vnode_data.cached_attrs.st_size, but didn't have exactly the same meaning. It was very confus
fusefs: don't track a file's size in two places
fuse_vnode_data.filesize was mostly redundant with fuse_vnode_data.cached_attrs.st_size, but didn't have exactly the same meaning. It was very confusing. This commit eliminates the former. It also eliminates fuse_vnode_refreshsize, which ignored the cache timeout value.
Sponsored by: The FreeBSD Foundation
show more ...
|
| #
96658124
|
| 13-May-2019 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: eliminate superfluous FUSE_GETATTR when filesize=0
fuse_vnode_refreshsize was using 0 as a flag value for filesize meaning "uninitialized" (thanks to the malloc(...M_ZERO) in fuse_vnode_allo
fusefs: eliminate superfluous FUSE_GETATTR when filesize=0
fuse_vnode_refreshsize was using 0 as a flag value for filesize meaning "uninitialized" (thanks to the malloc(...M_ZERO) in fuse_vnode_alloc. But this led to unnecessary getattr operations when the filesize legitimately happened to be zero. Fix by adding a distinct flag value.
Sponsored by: The FreeBSD Foundation
show more ...
|
| #
002e54b0
|
| 09-May-2019 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: clear a dir's attr cache when its contents change
Any change to a directory's contents should cause its mtime and ctime to be updated by the FUSE daemon. Clear its attribute cache so we'll
fusefs: clear a dir's attr cache when its contents change
Any change to a directory's contents should cause its mtime and ctime to be updated by the FUSE daemon. Clear its attribute cache so we'll get the new attributs the next time that they're needed. This affects the following VOPs: VOP_CREATE, VOP_LINK, VOP_MKDIR, VOP_MKNOD, VOP_REMOVE, VOP_RMDIR, and VOP_SYMLINK
Reported by: pjdfstest Sponsored by: The FreeBSD Foundation
show more ...
|
| #
f9b0e30b
|
| 29-Apr-2019 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: FIFO support
Sponsored by: The FreeBSD Foundation
|
| #
c9c34c20
|
| 11-Apr-2019 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: test that we reparent a vnode during rename
fusefs tracks each vnode's parent. The rename code was already correctly updating it. Delete a comment that said otherwise, and add a regression
fusefs: test that we reparent a vnode during rename
fusefs tracks each vnode's parent. The rename code was already correctly updating it. Delete a comment that said otherwise, and add a regression test for it.
Sponsored by: The FreeBSD Foundation
show more ...
|
| #
6124fd71
|
| 11-Apr-2019 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: Finish supporting -o default_permissions
I got most of -o default_permissions working in r346088. This commit adds sticky bit checks. One downside is that sometimes there will be an extra
fusefs: Finish supporting -o default_permissions
I got most of -o default_permissions working in r346088. This commit adds sticky bit checks. One downside is that sometimes there will be an extra FUSE_GETATTR call for the parent directory during unlink or rename. But in actual use I think those attributes will almost always be cached.
PR: 216391 Sponsored by: The FreeBSD Foundation
show more ...
|
| #
3f2c630c
|
| 09-Apr-2019 |
Alan Somers <asomers@FreeBSD.org> |
fusefs: implement attribute cache timeouts
The FUSE protocol allows the server to specify the timeout period for the client's attribute and entry caches. This commit implements the timeout period f
fusefs: implement attribute cache timeouts
The FUSE protocol allows the server to specify the timeout period for the client's attribute and entry caches. This commit implements the timeout period for the attribute cache. The entry cache's timeout period is currently disabled because it panics, and is guarded by the vfs.fusefs.lookup_cache_expire sysctl.
PR: 235773 Reported by: cem Sponsored by: The FreeBSD Foundation
show more ...
|