| #
45117ffc
|
| 28-Feb-2026 |
Konstantin Belousov <kib@FreeBSD.org> |
vfs: add VOP_DELAYED_SETSIZE() and related infrastructure
The change generalizes code that was initially developed for nfs client to handle filesystems that needs to call vnode_pager_setsize() while
vfs: add VOP_DELAYED_SETSIZE() and related infrastructure
The change generalizes code that was initially developed for nfs client to handle filesystems that needs to call vnode_pager_setsize() while only owning the vnode lock shared. Since vnode pager might need to trim or extend the vnode vm_object' page queue, the vnode lock for the call must be owned exclusive. This is typical for filesystems with remote authorative source of file attributes, like nfs/p9/fuse.
Handle the conflict by delaying the vnode_pager_setsize() to the next vnode locking to avoid relock. But if the next locking request is in shared mode, lock it exclusively instead, perform the delayed vnode_pager_setsize() call by doing VOP_DEFAULT_SETSIZE(), and then downgrade to shared.
Filesystems that opt into the feature must provide the implementation of VOP_DELAYED_SETSIZE() that actually calls vnode_pager_setsize(), and use vn_delay_setsize() helper to mark the vnode as requiring the delay call.
Reviewed by: rmacklem Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55595
show more ...
|
| #
e486066c
|
| 26-Feb-2026 |
Konstantin Belousov <kib@FreeBSD.org> |
VOP_RENAME(9): add flags argument
Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55539
|
| #
38d60d45
|
| 28-Nov-2025 |
Jason A. Harmening <jah@FreeBSD.org> |
vnode_if.src: fix function name in locking annotation
getwritevnode->getlowvnode
Reviewed by: kib, olce Tested by: pho MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D53988
|
| #
8b4908f8
|
| 23-Jul-2025 |
Mark Johnston <markj@FreeBSD.org> |
vfs: Lower-case VOP_WRITE pre and post hooks
For consistency with hooks for other VOPs. No functional change intended.
Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.fr
vfs: Lower-case VOP_WRITE pre and post hooks
For consistency with hooks for other VOPs. No functional change intended.
Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D51314
show more ...
|
| #
77b273d8
|
| 23-Jul-2025 |
Mark Johnston <markj@FreeBSD.org> |
vfs: Assert that VOP_READDIR sets *eofflag properly
Suggested by: kib Reviewed by: olce, kib MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D51300
|
| #
bc4430dc
|
| 03-Jul-2025 |
Mark Johnston <markj@FreeBSD.org> |
vfs: Add event notification points
The INOTIFY macro and its variants check if the vnode is being watched, and if so, calls into a slow path which adds an event to one or more inotify descriptors.
vfs: Add event notification points
The INOTIFY macro and its variants check if the vnode is being watched, and if so, calls into a slow path which adds an event to one or more inotify descriptors. Most of these events correspond to EVFILT_VNODE events as well, and are added to VOP *_post hooks.
Reviewed by: kib MFC after: 3 months Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50315
show more ...
|
| #
f1f23043
|
| 03-Jul-2025 |
Mark Johnston <markj@FreeBSD.org> |
vfs: Initial revision of inotify
Add an implementation of inotify_init(), inotify_add_watch(), inotify_rm_watch(), source-compatible with Linux. This provides functionality similar to kevent(2)'s E
vfs: Initial revision of inotify
Add an implementation of inotify_init(), inotify_add_watch(), inotify_rm_watch(), source-compatible with Linux. This provides functionality similar to kevent(2)'s EVFILT_VNODE, i.e., it lets applications monitor filesystem files for accesses. Compared to inotify, however, EVFILT_VNODE has the limitation of requiring the application to open the file to be monitored. This means that activity on a newly created file cannot be monitored reliably, and that a file descriptor per file in the hierarchy is required.
inotify on the other hand allows a directory and its entries to be monitored at once. It introduces a new file descriptor type to which "watches" can be attached; a watch is a pseudo-file descriptor associated with a file or directory and a set of events to watch for. When a watched vnode is accessed, a description of the event is queued to the inotify descriptor, readable with read(2). Events for files in a watched directory include the file name.
A watched vnode has its usecount bumped, so name cache entries originating from a watched directory are not evicted. Name cache entries are used to populate inotify events for files with a link in a watched directory. In particular, if a file is accessed with, say, read(2), an IN_ACCESS event will be generated for any watched hard link of the file.
The inotify_add_watch_at() variant is included so that this functionality is available in capability mode; plain inotify_add_watch() is disallowed in capability mode.
When a file in a nullfs mount is watched, the watch is attached to the lower vnode, such that accesses via either layer generate inotify events.
Many thanks to Gleb Popov for testing this patch and finding lots of bugs.
PR: 258010, 215011 Reviewed by: kib Tested by: arrowd MFC after: 3 months Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50315
show more ...
|
| #
4cbe4c48
|
| 18-Nov-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
VFS: add VOP_GETLOWVNODE()
It is similar to VOP_GETWRITEMOUNT(), and for given vnode vp should return the lower vnode which would actually handle write to vp. Flags allow to specify FREAD or FWRITE
VFS: add VOP_GETLOWVNODE()
It is similar to VOP_GETWRITEMOUNT(), and for given vnode vp should return the lower vnode which would actually handle write to vp. Flags allow to specify FREAD or FWRITE for benefit of possible unionfs implementation.
Reviewed by: markj, Olivier Certner <olce.freebsd@certner.fr> Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D42603
show more ...
|
| #
29363fb4
|
| 23-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl s
sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script.
Sponsored by: Netflix
show more ...
|
| #
031beb4e
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
|
| #
fa1ac969
|
| 07-Aug-2022 |
Gordon Bergling <gbe@FreeBSD.org> |
vnode(9): Fix a typo in a source code comment
- s/paramater/parameter/
MFC after: 3 days
|
| #
b214fcce
|
| 14-Dec-2021 |
Alan Somers <asomers@FreeBSD.org> |
Change VOP_READDIR's cookies argument to a **uint64_t
The cookies argument is only used by the NFS server. NFSv2 defines the cookie as 32 bits on the wire, but NFSv3 increased it to 64 bits. Our V
Change VOP_READDIR's cookies argument to a **uint64_t
The cookies argument is only used by the NFS server. NFSv2 defines the cookie as 32 bits on the wire, but NFSv3 increased it to 64 bits. Our VOP_READDIR, however, has always defined it as u_long, which is 32 bits on some architectures. Change it to 64 bits on all architectures. This doesn't matter for any in-tree file systems, but it matters for some FUSE file systems that use 64-bit directory cookies.
PR: 260375 Reviewed by: rmacklem Differential Revision: https://reviews.freebsd.org/D33404
show more ...
|
| #
47b248ac
|
| 03-Nov-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
Make locking assertions for VOP_FSYNC() and VOP_FDATASYNC() more correct
For devfs vnodes, it is fine to not lock vnodes for VOP_FSYNC(). Otherwise vnode must be locked exclusively, except for MNT_S
Make locking assertions for VOP_FSYNC() and VOP_FDATASYNC() more correct
For devfs vnodes, it is fine to not lock vnodes for VOP_FSYNC(). Otherwise vnode must be locked exclusively, except for MNT_SHARED_WRITES() where the shared lock is enough.
Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32761
show more ...
|
| #
f0c9847a
|
| 06-Nov-2021 |
Rick Macklem <rmacklem@FreeBSD.org> |
vfs: Add "ioflag" and "cred" arguments to VOP_ALLOCATE
When the NFSv4.2 server does a VOP_ALLOCATE(), it needs the operation to be done for the RPC's credential and not td_ucred. It also needs the w
vfs: Add "ioflag" and "cred" arguments to VOP_ALLOCATE
When the NFSv4.2 server does a VOP_ALLOCATE(), it needs the operation to be done for the RPC's credential and not td_ucred. It also needs the writing to be done synchronously.
This patch adds "ioflag" and "cred" arguments to VOP_ALLOCATE() and modifies vop_stdallocate() to use these arguments.
The VOP_ALLOCATE.9 man page will be patched separately.
Reviewed by: khng, kib Differential Revision: https://reviews.freebsd.org/D32865
show more ...
|
| #
2b68eb8e
|
| 01-Oct-2021 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: remove thread argument from VOP_STAT
and fo_stat.
|
| #
a638dc4e
|
| 12-Aug-2021 |
Ka Ho Ng <khng@FreeBSD.org> |
vfs: Add ioflag to VOP_DEALLOCATE(9)
The addition of ioflag allows callers passing IO_SYNC/IO_DATASYNC/IO_DIRECT down to the file system implementation. The vop_stddeallocate fallback implementation
vfs: Add ioflag to VOP_DEALLOCATE(9)
The addition of ioflag allows callers passing IO_SYNC/IO_DATASYNC/IO_DIRECT down to the file system implementation. The vop_stddeallocate fallback implementation is updated to pass the ioflag to the file system implementation. vn_deallocate(9) internally is also changed to pass ioflag to the VOP_DEALLOCATE call.
Sponsored by: The FreeBSD Foundation Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D31500
show more ...
|
| #
0dc332bf
|
| 05-Aug-2021 |
Ka Ho Ng <khng@FreeBSD.org> |
Add fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9).
fspacectl(2) is a system call to provide space management support to userspace applications. VOP_DEALLOCATE(9) is a VOP call to perform the
Add fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9).
fspacectl(2) is a system call to provide space management support to userspace applications. VOP_DEALLOCATE(9) is a VOP call to perform the deallocation. vn_deallocate(9) is a public KPI for kmods' use.
The purpose of proposing a new system call, a KPI and a VOP call is to allow bhyve or other hypervisor monitors to emulate the behavior of SCSI UNMAP/NVMe DEALLOCATE on a plain file.
fspacectl(2) comprises of cmd and flags parameters to specify the space management operation to be performed. Currently cmd has to be SPACECTL_DEALLOC, and flags has to be 0.
fo_fspacectl is added to fileops. VOP_DEALLOCATE(9) is added as a new VOP call. A trivial implementation of VOP_DEALLOCATE(9) is provided.
Sponsored by: The FreeBSD Foundation Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D28347
show more ...
|
| #
49c117c1
|
| 28-Jan-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
Add VOP_VPUT_PAIR() with trivial default implementation.
The VOP is intended to be used in situations where VFS has two referenced locked vnodes, typically a directory vnode dvp and a vnode vp that
Add VOP_VPUT_PAIR() with trivial default implementation.
The VOP is intended to be used in situations where VFS has two referenced locked vnodes, typically a directory vnode dvp and a vnode vp that is linked from the directory, and at least dvp is vput(9)ed. The child vnode can be also vput-ed, but optionally left referenced and locked.
There, at least UFS may need to do some actions with dvp which cannot be done while vp is also locked, so its lock might be dropped temporary. For instance, in some cases UFS needs to sync dvp to avoid filesystem state that is currently not handled by either kernel nor fsck. Having such VOP provides the neccessary context for filesystem which can do correct locking and handle potential reclamation of vp after relock.
Trivial implementation does vput(dvp) and optionally vput(vp).
Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
show more ...
|
| #
739ecbcf
|
| 23-Jan-2021 |
Mateusz Guzik <mjg@FreeBSD.org> |
cache: add symlink support to lockless lookup
Reviewed by: kib (previous version) Tested by: pho (previous version) Differential Revision: https://reviews.freebsd.org/D27488
|
| #
c7520caa
|
| 22-Oct-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: prevent avoidable evictions on mkdir of existing directories
mkdir -p /foo/bar/baz will mkdir each path component and ignore EEXIST.
The NOCACHE lookup will make the namecache unnecessarily ev
vfs: prevent avoidable evictions on mkdir of existing directories
mkdir -p /foo/bar/baz will mkdir each path component and ignore EEXIST.
The NOCACHE lookup will make the namecache unnecessarily evict the existing entry, and then fallback to the fs lookup routine eventually leading namei to return an error as the directory is already there.
For invocations like mkdir -p /usr/obj/usr/src/sys/GENERIC/modules this triggers fallbacks to the slowpath for concurrently executing lookups.
Tested by: pho Discussed with: kib
show more ...
|
| #
ab21ed17
|
| 20-Oct-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: drop the de facto curthread argument from VOP_INACTIVE
|
| #
8ecd87a3
|
| 20-Oct-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: drop spurious cred argument from VOP_VPTOCNP
|
| #
3c484f32
|
| 15-Sep-2020 |
Konstantin Belousov <kib@FreeBSD.org> |
Convert page cache read to VOP.
There are several negative side-effects of not calling into VOP layer at all for page cache reads. The biggest is the missed activation of EVFILT_READ knotes.
Also,
Convert page cache read to VOP.
There are several negative side-effects of not calling into VOP layer at all for page cache reads. The biggest is the missed activation of EVFILT_READ knotes.
Also, it allows filesystem to make more fine grained decision to refuse read from page cache.
Keep VIRF_PGREAD flag around, it is still useful for nullfs, and for asserts.
Reviewed by: markj Tested by: pho Discussed with: mjg Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D26346
show more ...
|
| #
e2515283
|
| 27-Aug-2020 |
Glen Barber <gjb@FreeBSD.org> |
MFH
Sponsored by: Rubicon Communications, LLC (netgate.com)
|
| #
8f226f4c
|
| 19-Aug-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: remove the always-curthread td argument from VOP_RECLAIM
|