Home | History | Annotate | Download | only in kern
History log of /src/sys/kern/vnode_if.src
RevisionDateAuthorComments
 1.85  15-Jun-2023  hannken VOP_IOCTL() is a wrapper around spec_ioctl() aka Xdev_ioctl() and
protected with spec_io_enter()/spec_io_exit() so there is no need
to force specific vnode locking.

Set locking requirement to '= = =' (unchanged, locked or unlocked).

PR kern/57450 (unplugging hung USB disk triggers panic via _vstate_assert)
 1.84  03-May-2022  hannken branches: 1.84.4;
Make option VNODE_LOCKDEBUG more functional.

- Add "LOCKED=EXCL" option for vnode operations needing exclusive locked nodes.

- As it is impossible to check for shared locks held by current thread avoid
false assertions by testing for exclusive lock only in the "LOCKED=NO" case.

- New option "RUMP_VNODE_LOCKDEBUG" enables VNODE_LOCKDEBUG for the rump kernel.
 1.83  20-Oct-2021  thorpej Overhaul of the EVFILT_VNODE kevent(2) filter:

- Centralize vnode kevent handling in the VOP_*() wrappers, rather than
forcing each individual file system to deal with it (except VOP_RENAME(),
because VOP_RENAME() is a mess and we currently have 2 different ways
of handling it; at least it's reasonably well-centralized in the "new"
way).
- Add support for NOTE_OPEN, NOTE_CLOSE, NOTE_CLOSE_WRITE, and NOTE_READ,
compatible with the same events in FreeBSD.
- Track which kevent notifications clients are interested in receiving
to avoid doing work for events no one cares about (avoiding, e.g.
taking locks and traversing the klist to send a NOTE_WRITE when
someone is merely watching for a file to be deleted, for example).

In support of the above:

- Add support in vnode_if.sh for specifying PRE- and POST-op handlers,
to be invoked before and after vop_pre() and vop_post(), respectively.
Basic idea from FreeBSD, but implemented differently.
- Add support in vnode_if.sh for specifying CONTEXT fields in the
vop_*_args structures. These context fields are used to convey information
between the file system VOP function and the VOP wrapper, but do not
occupy an argument slot in the VOP_*() call itself. These context fields
are initialized and subsequently interpreted by PRE- and POST-op handlers.
- Version VOP_REMOVE(), uses the a context field for the file system to report
back the resulting link count of the target vnode. Return this in tmpfs,
udf, nfs, chfs, ext2fs, lfs, and ufs.

NetBSD 9.99.92.
 1.82  02-Jul-2021  dholland Turn off fstrans for VOP_PARSEPATH. Fixes t_umountstress deadlock.

Diagnosis by hannken@.
 1.81  29-Jun-2021  dholland - Add a new vnode op: VOP_PARSEPATH.
- Move namei_getcomponent to genfs_vnops.c and call it genfs_parsepath.
- Add a parsepath entry to every vnode ops table.

VOP_PARSEPATH takes a directory vnode to be searched and a complete
following path and chooses how much of that path to consume. To begin
with, all parsepath calls are genfs_parsepath, which locates the first
'/' as always.

Note that the call doesn't take the whole struct componentname, only
the string. The other bits of struct componentname should not be
needed and there's no reason to cause potential complications by
exposing them.
 1.80  18-May-2020  hannken branches: 1.80.6;
VOP_STRATEGY() may still deadlock with devices.

Change FSTRANS from LAZY to NO.
 1.79  16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.78  11-Oct-2019  hannken As VOP_STRATEGY() usually calls itself on the file system holding "/dev"
it may deadlock on suspension of this file system.

Add fstrans type LAZY and use it for VOP_STRATEGY().

Adress PR kern/53624 (dom0 freeze on domU exit) is still there
 1.77  12-Jul-2017  hannken branches: 1.77.6; 1.77.10;
As VOP_ADVLOCK() may block indefinitely we cannot take fstrans here.

Fixes PR kern/52364: System hangs not much before showing the login prompt
 1.76  04-Jun-2017  hannken Add "FSTRANS=LOCK" and "FSTRANS=UNLOCK" to vop_lock and vop_unlock.

Add two "static inline" functions to vnode_if.c to handle MPSAFE
and FSTRANS before and after the "VCALL()".

Take FSTRANS and handle error before "VCALL(...vop_lock...)" and
release it after "VCALL(...vop_unlock...)".
 1.75  26-May-2017  riastradh branches: 1.75.2;
Make VOP_RECLAIM do the last unlock of the vnode.

VOP_RECLAIM naturally has exclusive access to the vnode, so having it
locked on entry is not strictly necessary -- but it means if there
are any final operations that must be done on the vnode, such as
ffs_update, requiring exclusive access to it, we can now kassert that
the vnode is locked in those operations.

We can't just have the caller release the last lock because some file
systems don't use genfs_lock, and require the vnode to remain valid
for VOP_UNLOCK to work, notably unionfs.
 1.74  26-Apr-2017  riastradh Change VOP_REMOVE and VOP_RMDIR to preserve lock/ref on dvp.

No change to vp -- the plan is to replace the node by the
componentname in the vop parameters, and let all directory vops do
lookups internally.

Proposed on tech-kern with no objections:
https://mail-index.netbsd.org/tech-kern/2017/04/17/msg021825.html
 1.73  16-Apr-2017  riastradh Back out previous.

Breaks file systems for which VOP_UNLOCK doesn't work on a reclaimed
vnode.

The only case in tree right now is sys/fs/union -- most file systems
use genfs_unlock, which does work on a reclaimed vnode.

Maybe we can work around this -- and still enable VOP_RECLAIM's
callees to assert lock ownership -- by having VOP_RECLAIM unlock the
vnode instead.
 1.72  15-Apr-2017  riastradh Keep vnode locked during VOP_RECLAIM.

No bump because it wouldn't have been possible to acquire the lock in
VOP_RECLAIM anyway -- instant deadlock because vn_lock waits to
transition out of the RECLAIMING state first. Benefit is that we can
now assert ownership of the lock in any operations called by
VOP_RECLAIM.

Discussed on tech-kern:

https://mail-index.netbsd.org/tech-kern/2017/04/01/msg021751.html
 1.71  11-Apr-2017  riastradh Make VOP_INACTIVE preserve vnode lock on return.

Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2017/04/01/msg021751.html

Ride 7.99.68, a bumpy bus of incremental vfs improvements!
 1.70  22-Feb-2017  hannken Prepare to move fstrans into vnode_if.c, allow "FSTRANS=YES"
and "FSTRANS=NO" in the vop description.
Add fstrans_start()/fstrans_done() to all vops that have FSTRANS=YES
or have the first vnode unlocked.
 1.69  20-Apr-2015  riastradh branches: 1.69.2; 1.69.4;
Fix comment in vnode_if.src to reflect change to VOP_LINK.
 1.68  20-Apr-2015  riastradh Make VOP_LINK return directory still locked and referenced.

Ride 7.99.10 bump.
 1.67  25-Jul-2014  dholland branches: 1.67.4;
Add VOP_FALLOCATE and VOP_FDISCARD.
 1.66  07-Feb-2014  hannken branches: 1.66.2;
Change vnode operation lookup to return the resulting vnode *vpp unlocked.
Change cache_lookup() to return an unlocked vnode.

Discussed on tech-kern@
 1.65  23-Jan-2014  hannken Change vnode operations create, mknod, mkdir and symlink to return
the resulting vnode *vpp unlocked.

Discussed on tech-kern@
 1.64  17-Jan-2014  hannken Change vnode operations create, mknod, mkdir and symlink to keep the
directory node dvp locked on return.

Discussed on tech-kern@
 1.63  14-Oct-2011  hannken branches: 1.63.2; 1.63.12; 1.63.16;
Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock. Make all calls outside of file systems respect it.

The calls from file systems need review.

No objections from tech-kern.
 1.62  11-Jul-2011  hannken Change VOP_BWRITE() to take a vnode as its first argument like all other
VOPs do. Layered file systems no longer have to modify bp->b_vp and run
into trouble when an async VOP_BWRITE() uses the wrong vnode.

Adresses PR kern/38762 panic: vwakeup: neg numoutput

No objections from tech-kern@.
 1.61  02-Apr-2011  rmind Update UCB license (3rd clause drop).
 1.60  02-Jan-2011  dholland branches: 1.60.2;
Remove references to SAVESTART and SAVENAME in comments.
 1.59  24-Jun-2010  hannken Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.58  15-Nov-2008  pooka branches: 1.58.6; 1.58.8;
vpp is not logically passed in IN with lookup, so INOUT -> OUT.
No functional change, but consistent with the rest.
 1.57  25-Jan-2008  ad branches: 1.57.6; 1.57.10; 1.57.16; 1.57.18;
Remove VOP_LEASE. Discussed on tech-kern.
 1.56  02-Jan-2008  ad Merge vmlocking2 to head.
 1.55  26-Nov-2007  pooka branches: 1.55.2; 1.55.6;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.54  27-Jul-2007  pooka branches: 1.54.4; 1.54.6; 1.54.12; 1.54.14;
Change unused fflags parameter in VOP_MMAP to prot and pass in
desired vm protection.
 1.53  22-Jul-2007  pooka Introduce WILLMAKE for vnode operations which create a new vnode.
Insert a KASSERT along the return path of such operations to check
that the operation set the vnode size.
 1.52  09-Apr-2007  gdt branches: 1.52.4;
vop_link: reorder commented arguments to match actual calling order
(dvp, vp).

ok wrstuden@
 1.51  07-Jan-2007  pooka branches: 1.51.2; 1.51.6; 1.51.8;
update some comments for vnode locking smoergasbord change

amazing -- the description of VOP_LOOKUP is suddenly human-readable
 1.50  14-May-2006  elad branches: 1.50.8; 1.50.12;
integrate kauth.
 1.49  04-May-2006  perseant Change VOP_FCNTL to take an unlocked vnode. Approved by wrstuden@.
 1.48  30-Dec-2005  yamt branches: 1.48.4; 1.48.6; 1.48.8; 1.48.10; 1.48.12;
remove a wrong "LOCKED=YES" from vop_bmap. pointed by Reinoud Zandijk.
 1.47  11-Dec-2005  christos merge ktrace-lwp.
 1.46  02-Nov-2005  yamt branches: 1.46.2;
merge yamt-vop branch. remove following VOPs.

VOP_BLKATOFF
VOP_VALLOC
VOP_BALLOC
VOP_REALLOCBLKS
VOP_VFREE
VOP_TRUNCATE
VOP_UPDATE
 1.45  25-Sep-2005  isaki branches: 1.45.2;
Correct typo in a comment. ok'ed by wiz@.
 1.44  26-Feb-2005  perry branches: 1.44.4;
revert trailing whitespace change -- it had unintended consequences
 1.43  26-Feb-2005  perry nuke trailing whitespace
 1.42  02-Jan-2005  thorpej branches: 1.42.2;
Add the system call and VFS infrastructure for file system extended
attributes.

From FreeBSD.
 1.41  21-Sep-2004  thorpej Add a new VNODE_LOCKDEBUG option, which enables checks in the VOP_*()
calls to ensure that the vnode lock state is as expected when the VOP
call is made. Modify vnode_if.src to set the expected state according
to the documenting lock table for each VOP. Modify vnode_if.sh to emit
the checks.

Notes:
- The checks are only performed if the vnode has the VLOCKSWORK bit
set. Some file systems (e.g. specfs) don't even bother with vnode
locks, so of course the checks will fail.
- We can't actually run with VNODE_LOCKDEBUG because there are so many
vnode locking problems, not the least of which is the "use SHARED for
VOP_READ()" issue, which screws things up for the entire call chain.

Inspired by similar changes in OpenBSD, but implemented differently.
 1.40  10-Sep-2004  yamt VOP_BMAP isn't protected by vnode locks these days.
 1.39  27-May-2004  yamt update to match with the recent reality: getpages doesn't care about
vnode locks.
 1.38  25-Jan-2004  hannken Make VOP_STRATEGY(bp) a real VOP as discussed on tech-kern.
 1.37  24-Jan-2004  wiz Add semicolons after variable declarations; closes PR 24201.
 1.36  17-Nov-2003  wiz Various typo fixes from Jonathon Gray via jmc@openbsd.
 1.35  29-Jun-2003  fvdl branches: 1.35.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.34  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.33  10-Apr-2003  jdolecek 'tvp' in vop_rename needs to be vput(), not vrele()d, so adjust the
description here to match current reality
okayed by Bill Studenmund
 1.32  10-Apr-2003  jdolecek Use 'void *' instead of 'caddr_t' in prototypes of VOP_IOCTL, VOP_FCNTL
and VOP_ADVLOCK
 1.31  23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.30  15-Sep-2001  chs a whole bunch of changes to improve performance and robustness under load:

- remove special treatment of pager_map mappings in pmaps. this is
required now, since I've removed the globals that expose the address range.
pager_map now uses pmap_kenter_pa() instead of pmap_enter(), so there's
no longer any need to special-case it.
- eliminate struct uvm_vnode by moving its fields into struct vnode.
- rewrite the pageout path. the pager is now responsible for handling the
high-level requests instead of only getting control after a bunch of work
has already been done on its behalf. this will allow us to UBCify LFS,
which needs tighter control over its pages than other filesystems do.
writing a page to disk no longer requires making it read-only, which
allows us to write wired pages without causing all kinds of havoc.
- use a new PG_PAGEOUT flag to indicate that a page should be freed
on behalf of the pagedaemon when it's unlocked. this flag is very similar
to PG_RELEASED, but unlike PG_RELEASED, PG_PAGEOUT can be cleared if the
pageout fails due to eg. an indirect-block buffer being locked.
this allows us to remove the "version" field from struct vm_page,
and together with shrinking "loan_count" from 32 bits to 16,
struct vm_page is now 4 bytes smaller.
- no longer use PG_RELEASED for swap-backed pages. if the page is busy
because it's being paged out, we can't release the swap slot to be
reallocated until that write is complete, but unlike with vnodes we
don't keep a count of in-progress writes so there's no good way to
know when the write is done. instead, when we need to free a busy
swap-backed page, just sleep until we can get it busy ourselves.
- implement a fast-path for extending writes which allows us to avoid
zeroing new pages. this substantially reduces cpu usage.
- encapsulate the data used by the genfs code in a struct genfs_node,
which must be the first element of the filesystem-specific vnode data
for filesystems which use genfs_{get,put}pages().
- eliminate many of the UVM pagerops, since they aren't needed anymore
now that the pager "put" operation is a higher-level operation.
- enhance the genfs code to allow NFS to use the genfs_{get,put}pages
instead of a modified copy.
- clean up struct vnode by removing all the fields that used to be used by
the vfs_cluster.c code (which we don't use anymore with UBC).
- remove kmem_object and mb_object since they were useless.
instead of allocating pages to these objects, we now just allocate
pages with no object. such pages are mapped in the kernel until they
are freed, so we can use the mapping to find the page to free it.
this allows us to remove splvm() protection in several places.

The sum of all these changes improves write throughput on my
decstation 5000/200 to within 1% of the rate of NetBSD 1.5
and reduces the elapsed time for "make release" of a NetBSD 1.5
source tree on my 128MB pc to 10% less than a 1.5 kernel took.
 1.29  24-Jul-2001  assar branches: 1.29.2;
change vop_symlink and vop_mknod to return vpp (the created node)
refed, so that the caller can actually use it. update callers and
file systems that implement these vnode operations
 1.28  26-May-2001  chs branches: 1.28.2;
replace vm_page_t with struct vm_page *.
 1.27  26-May-2001  chs replace vm_page_t with struct vm_page *.
 1.26  27-Nov-2000  chs branches: 1.26.2;
Initial integration of the Unified Buffer Cache project.
 1.25  19-Sep-2000  fvdl Add start and end parameters to the fsync VOP, giving a range of the
file to write out. If both are 0, the whole file is synced. A filesystem
that is not able to sync out a range of a file may elect to sync
the whole file anyway.
 1.24  13-May-2000  perseant branches: 1.24.4;
Change the sementics of the last parameter from a boolean ("waitfor") to
a set of flags ("flags"). Two flags are defined, UPDATE_WAIT and
UPDATE_DIROP.

Under the old semantics, VOP_UPDATE would block if waitfor were set,
under the assumption that directory operations should be done
synchronously. At least LFS and FFS+softdep do not make this
assumption; FFS+softdep got around the problem by enclosing all relevant
calls to VOP_UPDATE in a "if(!DOINGSOFTDEP(vp))", while LFS simply
ignored waitfor, one of the reasons why NFS-serving an LFS filesystem
did not work properly.

Under the new semantics, the UPDATE_DIROP flag is a hint to the
fs-specific update routine that the call comes from a dirop routine, and
should be wait for, or not, accordingly.

Closes PR#8996.
 1.23  07-Dec-1999  thorpej Remove duplicate vop_balloc definition accidentally added in rev 1.21.
 1.22  07-Dec-1999  wrstuden Add comments to describe the lookup parameters needed in the various
component name fragments passed into VOP calls.
 1.21  15-Nov-1999  fvdl Add Kirk McKusick's soft updates code to the trunk. Not enabled by
default, as the copyright on the main file (ffs_softdep.c) is such
that is has been put into gnusrc. options SOFTDEP will pull this
in. This code also contains the trickle syncer.

Bump version number to 1.4O
 1.20  11-Aug-1999  wrstuden branches: 1.20.2; 1.20.4; 1.20.8;
Modify comments regarding VOP_LOOKUP. Revised lookup description, and also
document both cases which can set PDIRUNLOCK.

Reviewed by Bill Sommerfeld.
 1.19  03-Aug-1999  wrstuden Add VOP_FCNTL.
 1.18  07-Jul-1999  wrstuden Update syntax to support WILLUNLOCK and WILLPUT syntax. Change calls which
really vput to indicate that rather than just WILLRELE.
 1.17  21-Jun-1999  sommerfeld Correct comment about how LOCKPARENT affects VOP_LOOKUP
 1.16  22-Mar-1999  sommerfe branches: 1.16.4;
Include some comments with more details on the VOP_LOOKUP locking protocol
 1.15  26-Feb-1999  wrstuden Modify VOP_CLOSE vnode op to always take a locked vnode. Change vn_close
to pass down a locked node. Modify union_copyup() to call VOP_CLOSE
locked nodes.

Also fix a bug in union_copyup() where a lock on the lower vnode would
only be released if VOP_OPEN didn't fail.
 1.14  05-Jun-1998  kleink branches: 1.14.4;
Replace the `waitfor' argument to the fsync vnode operator with a `flags'
argument.
 1.13  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.12  10-Oct-1997  fvdl Make last argument to VOP_READDIR off_t.
 1.11  07-Sep-1996  mycroft branches: 1.11.10;
Implement poll(2).
 1.10  11-May-1996  mycroft Change VOP_UPDATE() semantics:
* Make 2nd and 3rd args timespecs, not timevals.
* Consistently pass a Boolean as the 4th arg (except in LFS).
Also, fix ffs_update() and lfs_update() to actually change the nsec fields.
 1.9  09-Feb-1996  mycroft Fix vop_link, vop_symlink, and vop_remove semantics in several ways:
* Change the argument names to vop_link so they actually make sense.
* Implement vop_link and vop_symlink for all file systems, so they do proper
cleanup.
* Require the file system to decide whether or not linking and unlinking of
directories is allowed, and disable it for all current file systems.
 1.8  14-Dec-1994  mycroft Remove a_fp.
 1.7  14-Dec-1994  mycroft Add vop_whiteout, per CSRG.
 1.6  13-Dec-1994  mycroft Turn lease_check() into a vnode op, per CSRG.
 1.5  14-Nov-1994  christos added extra argument in vn_open and VOP_OPEN to allow cloning devices
 1.4  30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.3  20-Oct-1994  cgd update for new syscall args description mechanism
 1.2  29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.1  08-Jun-1994  mycroft branches: 1.1.1;
Update to 4.4-Lite fs code.
 1.1.1.3  01-Mar-1998  fvdl Import some files that were changed after Lite2
 1.1.1.2  01-Mar-1998  fvdl Import 4.4BSD-Lite2
 1.1.1.1  01-Mar-1998  fvdl Import 4.4BSD-Lite for reference
 1.11.10.1  14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.4.1  09-Nov-1998  chs initial snapshot. lots left to do.
 1.16.4.7  31-Aug-1999  perseant Rudimentary support for LFS under UBC:

- LFS-specific VOP_BALLOC and VOP_PUTPAGES vnode ops.

- getblk VREG panic #ifdef'd out (can be reinstated when Ifile is
internalized and Ifile can be made another type from VREG)

- interface to VOP_PUTPAGES changed to pass all pager flags, not
just sync. FS putpages routines must know about the pager flags.

- new LFS magic disk address, -2 ("unwritten"), meaning accounted for
but not assigned to a fixed disk location (since LFS does these two
things separately, and the previous accounting method using buffer
headers no longer will work). Changed references to (foo == (daddr_t)-1)
to (foo < 0). Since disk drivers reject all addresses < 0, this should
not present a problem for other FSs.
 1.16.4.6  09-Aug-1999  chs create a new type "voff_t" for uvm_object offsets
and define it to be "off_t". also, remove pgo_asyncget().
 1.16.4.5  02-Aug-1999  thorpej Update from trunk.
 1.16.4.4  31-Jul-1999  chs VOP_BALLOC() now allocates a range instead of just one block.
 1.16.4.3  04-Jul-1999  chs add VOP_BALLOC().
 1.16.4.2  01-Jul-1999  thorpej Sync w/ -current.
 1.16.4.1  07-Jun-1999  chs merge everything from chs-ubc branch.
 1.20.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.20.4.1  19-Oct-1999  fvdl Bring in Kirk McKusick's FFS softdep code on a branch.
 1.20.2.2  08-Dec-2000  bouyer Sync with HEAD.
 1.20.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.24.4.1  14-Dec-2000  he Pull up revision 1.25 (requested by fvdl):
Improve NFS performance, possibly with as much as 100% in
throughput. Please note: this implies a kernel interface change,
VOP_FSYNC gains two arguments.
 1.26.2.4  11-Nov-2002  nathanw Catch up to -current
 1.26.2.3  21-Sep-2001  nathanw Catch up to -current.
 1.26.2.2  24-Aug-2001  nathanw Catch up with -current.
 1.26.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.28.2.3  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.28.2.2  03-Aug-2001  lukem update to -current
 1.28.2.1  10-Jul-2001  lukem add vop_kqfilter
 1.29.2.3  01-Oct-2001  fvdl Catch up with -current.
 1.29.2.2  18-Sep-2001  fvdl Do that regen thang.
 1.29.2.1  18-Sep-2001  fvdl Various changes to make cloning devices possible:

* Add an extra argument (struct vnode **) to VOP_OPEN. If it is
not NULL, specfs will create a cloned (aliased) vnode during
the call, and return it there. The caller should release and
unlock the original vnode if a new vnode was returned. The
new vnode is returned locked.

* Add a flag field to the cdevsw and bdevsw structures.
DF_CLONING indicates that it wants a new vnode for each
open (XXX is there a better way? devprop?)

* If a device is cloning, always call the close entry
point for a VOP_CLOSE.


Also, rewrite cons.c to do the right thing with vnodes. Use VOPs
rather then direct device entry calls. Suggested by mycroft@

Light to moderate testing done an i386 system (arch doesn't matter
though, these are MI changes).
 1.35.2.7  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.35.2.6  17-Jan-2005  skrll Sync with HEAD.
 1.35.2.5  24-Sep-2004  skrll Sync with HEAD.
 1.35.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.35.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.35.2.2  03-Aug-2004  skrll Sync with HEAD
 1.35.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.42.2.1  29-Apr-2005  kent sync with -current
 1.44.4.6  04-Feb-2008  yamt sync with head.
 1.44.4.5  21-Jan-2008  yamt sync with head
 1.44.4.4  07-Dec-2007  yamt sync with head
 1.44.4.3  03-Sep-2007  yamt sync with head.
 1.44.4.2  26-Feb-2007  yamt sync with head.
 1.44.4.1  21-Jun-2006  yamt sync with head.
 1.45.2.1  20-Oct-2005  yamt remove the following VOPs.

VOP_BLKATOFF
VOP_VALLOC
VOP_BALLOC
VOP_REALLOCBLKS
VOP_VFREE
VOP_TRUNCATE
VOP_UPDATE
 1.46.2.2  18-Nov-2005  yamt - associate read-ahead context to vnode, rather than file.
- revert VOP_READ prototype.
 1.46.2.1  15-Nov-2005  yamt add a readahead context argument to VOP_READ.
 1.48.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.48.10.2  11-May-2006  elad sync with head
 1.48.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.48.8.1  24-May-2006  yamt sync with head.
 1.48.6.1  01-Jun-2006  kardel Sync with head.
 1.48.4.1  09-Sep-2006  rpaulo sync with head
 1.50.12.1  17-Feb-2007  tron Apply patch (requested by chs in ticket #422):
- Fix various deadlock problems with nullfs and unionfs.
- Speed up path lookups by upto 25%.
 1.50.8.1  12-Jan-2007  ad Sync with head.
 1.51.8.1  11-Jul-2007  mjf Sync with head.
 1.51.6.3  16-Sep-2007  ad Checkpoint work in progress on the vnode lifecycle and reference counting
stuff. This makes it work properly without kernel_lock and fixes a few
quite old bugs. See vfs_subr.c 1.283.2.17 for details.
 1.51.6.2  20-Aug-2007  ad Sync with HEAD.
 1.51.6.1  10-Apr-2007  ad Sync with head.
 1.51.2.1  15-Apr-2007  yamt sync with head.
 1.52.4.1  15-Aug-2007  skrll Sync with HEAD.
 1.54.14.2  27-Jul-2007  pooka Change unused fflags parameter in VOP_MMAP to prot and pass in
desired vm protection.
 1.54.14.1  27-Jul-2007  pooka file vnode_if.src was added on branch matt-mips64 on 2007-07-27 08:26:39 +0000
 1.54.12.2  18-Feb-2008  mjf Sync with HEAD.
 1.54.12.1  08-Dec-2007  mjf Sync with HEAD.
 1.54.6.2  23-Mar-2008  matt sync with HEAD
 1.54.6.1  09-Jan-2008  matt sync with HEAD
 1.54.4.1  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.55.6.1  02-Jan-2008  bouyer Sync with HEAD
 1.55.2.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.57.18.1  19-Jan-2009  skrll Sync with HEAD.
 1.57.16.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.57.10.2  11-Aug-2010  yamt sync with head.
 1.57.10.1  04-May-2009  yamt sync with head.
 1.57.6.1  17-Jan-2009  mjf Sync with HEAD.
 1.58.8.3  21-Apr-2011  rmind sync with head
 1.58.8.2  05-Mar-2011  rmind sync with head
 1.58.8.1  03-Jul-2010  rmind sync with head
 1.58.6.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.60.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.63.16.1  18-May-2014  rmind sync with head
 1.63.12.2  03-Dec-2017  jdolecek update from HEAD
 1.63.12.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.63.2.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.66.2.1  10-Aug-2014  tls Rebase.
 1.67.4.2  28-Aug-2017  skrll Sync with HEAD
 1.67.4.1  06-Jun-2015  skrll Sync with HEAD
 1.69.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.69.2.2  26-Apr-2017  pgoyette Sync with HEAD
 1.69.2.1  20-Mar-2017  pgoyette Sync with HEAD
 1.75.2.3  14-Oct-2019  martin Pull up following revision(s) (requested by hannken in ticket #1405):

sys/kern/vnode_if.sh: revision 1.67
sys/kern/vnode_if.src: revision 1.78

As VOP_STRATEGY() usually calls itself on the file system holding "/dev"
it may deadlock on suspension of this file system.

Add fstrans type LAZY and use it for VOP_STRATEGY().

Adress PR kern/53624 (dom0 freeze on domU exit) is still there
 1.75.2.2  25-Jul-2017  snj Pull up following revision(s) (requested by hannken in ticket #130):
sys/kern/vnode_if.src: revision 1.77
As VOP_ADVLOCK() may block indefinitely we cannot take fstrans here.
Fixes PR kern/52364: System hangs not much before showing the login prompt
 1.75.2.1  04-Jun-2017  bouyer pullup the following revisions, requested by hannken in ticket #2:
src/share/man/man9/fstrans.9 1.25
src/sys/kern/vfs_mount.c 1.66
src/sys/kern/vfs_subr.c 1.468
src/sys/kern/vfs_trans.c 1.46
src/sys/kern/vfs_vnode.c 1.94, 1.95, 1.96
src/sys/kern/vnode_if.c 1.105, 1.106
src/sys/kern/vnode_if.sh 1.65, 1.66
src/sys/kern/vnode_if.src 1.76
src/sys/miscfs/genfs/genfs_io.c 1.69
src/sys/miscfs/genfs/genfs_vnops.c 1.196, 1.197
src/sys/miscfs/genfs/layer_extern.h 1.40
src/sys/miscfs/genfs/layer_vfsops.c 1.51
src/sys/miscfs/genfs/layer_vnops.c 1.67
src/sys/miscfs/nullfs/null_vnops.c 1.42
src/sys/miscfs/overlay/overlay_vnops.c 1.24
src/sys/miscfs/umapfs/umap_vnops.c 1.60
src/sys/rump/include/rump/rumpvnode_if.h 1.29, 1.30
src/sys/rump/librump/rumpkern/emul.c 1.182
src/sys/rump/librump/rumpvfs/rumpvnode_if.c 1.29, 1.30
src/sys/sys/fstrans.h 1.11
src/sys/sys/vnode.h 1.278
src/sys/sys/vnode_if.h 1.100, 1.101
src/sys/sys/vnode_impl.h 1.14, 1.15
src/sys/ufs/lfs/lfs_pages.c 1.12

Vnode state, lock and fstrans cleanup:
- Rename vnode state "VS_ACTIVE" to "VS_LOADED" and add synthetic
state "VS_ACTIVE" to assert a loaded vnode with usecount > 0.

- Redo FSTRANS in vnode_if.c and use it for VOP_LOCK and VOP_UNLOCK.

- Cleanup the genfs lock operations.

- Make "struct vnode_impl" member "vi_lock" a krwlock_t again.

- Remove the lock type argument from fstrans_start and
fstrans_start_nowait,
remove now unused FSTRANS state "FSTRANS_SUSPENDING".
 1.77.10.2  19-May-2020  martin Pull up following revision(s) (requested by hannken in ticket #917):

sys/kern/vnode_if.src: revision 1.80
sys/kern/vnode_if.c: revision 1.112

VOP_STRATEGY() may still deadlock with devices.

Change FSTRANS from LAZY to NO.

Regen.
 1.77.10.1  15-Oct-2019  martin Pull up following revision(s) (requested by hannken in ticket #307):

sys/kern/vnode_if.sh: revision 1.67
sys/kern/vnode_if.src: revision 1.78

As VOP_STRATEGY() usually calls itself on the file system holding "/dev"
it may deadlock on suspension of this file system.

Add fstrans type LAZY and use it for VOP_STRATEGY().

Adress PR kern/53624 (dom0 freeze on domU exit) is still there
 1.77.6.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.80.6.1  01-Aug-2021  thorpej Sync with HEAD.
 1.84.4.1  21-Jun-2023  martin Pull up following revision(s) (requested by hannken in ticket #197):

sys/kern/vnode_if.src: revision 1.85
share/man/man9/vnodeops.9: revision 1.101

VOP_IOCTL() is a wrapper around spec_ioctl() aka Xdev_ioctl() and
protected with spec_io_enter()/spec_io_exit() so there is no need
to force specific vnode locking.
Set locking requirement to '= = =' (unchanged, locked or unlocked).

RSS XML Feed