Home | History | Annotate | Download | only in genfs
History log of /src/sys/miscfs/genfs/layer_vnops.c
RevisionDateAuthorComments
 1.72  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.71  16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.70  13-Apr-2020  ad Replace most uses of vp->v_usecount with a call to vrefcnt(vp), a function
that hides the details and does atomic_load_relaxed(). Signature matches
FreeBSD.
 1.69  04-Apr-2020  ad branches: 1.69.2;
Merge the remaining changes from the ad-namecache branch, affecting namei()
and getcwd():

- push vnode locking back as far as possible.
- do most lookups directly in the namecache, avoiding vnode locks & refs.
- don't block new refs to vnodes across VOP_INACTIVE().
- get shared locks for VOP_LOOKUP() if the file system supports it.
- correct lock types for VOP_ACCESS() / VOP_GETATTR() in a few places.

Possible future enhancements:

- make the lookups lockless.
- support dotdot lookups by being lockless and inferring absence of chroot.
- maybe make it work for layered file systems.
- avoid vnode references at the root & cwd.
 1.68  23-Feb-2020  ad UVM locking changes, proposed on tech-kern:

- Change the lock on uvm_object, vm_amap and vm_anon to be a RW lock.
- Break v_interlock and vmobjlock apart. v_interlock remains a mutex.
- Do partial PV list locking in the x86 pmap. Others to follow later.
 1.67  04-Jun-2017  hannken branches: 1.67.6; 1.67.12;
Operations fstrans_start() and fstrans_start_nowait() now always
use FSTRANS_SHARED as lock type so remove the lock type argument.

File system state FSTRANS_SUSPENDING is now unused so remove it.

Regen vnode_if files.

Ride 8.99.1 less than a hour ago.
 1.66  26-May-2017  riastradh branches: 1.66.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.65  24-May-2017  hannken Protect layer_getpages against vnodes disappearing during a
forced unmount.
 1.64  07-May-2017  hannken Move v_writecount adjustment from revoke to reclaim.
 1.63  26-Apr-2017  riastradh branches: 1.63.2;
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.62  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.61  30-Mar-2017  hannken Locking a layer vnode is racy as it may become reclaimed before
calling the operation on the lower vnode.

Replace vi_lock with a rw_obj and change layered file systems
to share the lock with the lower vnode.

Layered file systems now use genfs_lock()/_unlock/_islocked().

Welcome to 7.99.67
 1.60  27-Jan-2017  hannken Handle v_writecount from layer_open(), layer_close() and layer_revoke()
so lower file system vnodes get marked as open for writing.
 1.59  20-Aug-2016  hannken branches: 1.59.2;
Remove now obsolete operation vcache_remove().

Welcome to 7.99.36
 1.58  25-May-2014  hannken branches: 1.58.4; 1.58.8;
Change layerfs from hashlist to vcache.
Make VI_LOCKSHARE public again.

Ride 6.99.43
 1.57  24-Mar-2014  hannken branches: 1.57.2;
- Make VI_XLOCK, VI_CLEAN and VI_LOCKSHARE private to kern/vfs_*.c.
- Make vwait() static.
- Add vdead_check() to check a vnode for being or becoming dead.

Discussed on tech-kern.

Welcome to 6.99.38
 1.56  12-Mar-2014  hannken Restructure layer_lock() to always lock before testing for dead node.
Use ISSET() to test flags, add assertions.
 1.55  27-Feb-2014  hannken The current implementation of vn_lock() is racy. Modification of
the vnode operations vector for active vnodes is unsafe because it
is not known whether deadfs or the original file system will be
called.

- Pass down LK_RETRY to the lock operation (hint for deadfs only).

- Change deadfs lock operation to return ENOENT if LK_RETRY is unset.

- Change all other lock operations to check for dead vnode once
the vnode is locked and unlock and return ENOENT in this case.

With these changes in place vnode lock operations will never succeed
after vclean() has marked the vnode as VI_XLOCK and before vclean()
has changed the operations vector.

Adresses PR kern/37706 (Forced unmount of file systems is unsafe)

Discussed on tech-kern.

Welcome to 6.99.33
 1.54  07-Feb-2014  hannken Change vnode operation lookup to return the resulting vnode *vpp unlocked.
Change cache_lookup() to return an unlocked vnode.

Discussed on tech-kern@

Welcome to 6.99.31
 1.53  29-Jan-2014  hannken Allow layer_node_create() with unlocked lower node and change
layer_bypass() to enter nodes from creation operations unlocked.
 1.52  23-Jan-2014  hannken Change vnode operations create, mknod, mkdir and symlink to return
the resulting vnode *vpp unlocked.

Discussed on tech-kern@

Welcome to 6.99.30
 1.51  10-Oct-2012  dholland branches: 1.51.2;
In layer_lookup(), clear *vpp before returning EROFS, as otherwise a
stale value can be returned and this causes a diagnostic panic in
namei.

In relookup(), clear *vpp before calling VOP_LOOKUP, as is done in
lookup_once(), as an additional precautionary measure.

(in theory both of these fixes are not required together)

Should fix PR 47040.
 1.50  11-Jul-2011  hannken branches: 1.50.2; 1.50.8; 1.50.12;
Layer_fsync(): when syncing a device node call spec_fsync() to clean the
layer node before descending to the lower file system.

Adresses PR kern/38762 panic: vwakeup: neg numoutput
 1.49  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.

- change all occurences of VOP_BWRITE(bp) to VOP_BWRITE(bp->b_vp, bp).
- remove layer_bwrite().
- welcome to 5.99.55

Adresses PR kern/38762 panic: vwakeup: neg numoutput

No objections from tech-kern@.
 1.48  12-Jun-2011  rmind Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.47  03-Apr-2011  rmind branches: 1.47.2;
- Use offsetof() in VOPARG_OFFSETOF() instead of re-implementing it.
- Remove VDESC_NOMAP_VPP and VDESC_VPP_WILLRELE.
- Remove VRELEL_NOINACTIVE and VRELEL_ONHEAD.
 1.46  13-Jan-2011  hannken branches: 1.46.2;
Layer_revoke(): change previous to always take an extra reference on the
lower vnode before passing down the VOP_REVOKE(). This way VOP_REVOKE()
on a layered file system always inactivates and closes the lower vnode.

Should finally fix PR kern/43456.
 1.45  10-Jan-2011  hannken Add layer_revoke() that adjusts the lower vnode use count to be at least as
high as the upper vnode count before passing down the VOP_REVOKE().

This way vclean() check for active (vp->v_usecount > 1) vnodes gets it right.

Should fix PR kern/43456.
 1.44  02-Jan-2011  hannken layer_inactive: With specnodes introduced during vmlocking2
it is safe to cache device nodes.

Tested with nullfs only as unionfs with device nodes panics.
 1.43  02-Jul-2010  hannken LK_INTERLOCK is no longer a valid flag for VOP_LOCK(). This makes
layer_*lock*() obsolete. Remove them and handle lock operations
with the generic bypass function.

Ride 5.99.34.
 1.42  02-Jul-2010  rmind Slightly clean-up layerfs and nullfs: update the big description more to
the reality (remove duplicate one in nullfs, merge some differences from
it), KNF, improve and update some comments, add few KASSERT()s, remove
unused declarations, avoid double inclusion of headers, misc.

No functional changes.
 1.41  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.40  06-Jun-2010  hannken Change layered file systems to always pass the locking VOP's down to the
leaf file system. Remove now unused member v_vnlock from struct vnode.
Welcome to 5.99.30

Discussed on tech-kern.
 1.39  08-Jan-2010  pooka branches: 1.39.2; 1.39.4;
The VATTR_NULL/VREF/VHOLD/HOLDRELE() macros lost their will to live
years ago when the kernel was modified to not alter ABI based on
DIAGNOSTIC, and now just call the respective function interfaces
(in lowercase). Plenty of mix'n match upper/lowercase has creeped
into the tree since then. Nuke the macros and convert all callsites
to lowercase.

no functional change
 1.38  14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.37  14-Feb-2009  plunky consistency checks made inside #ifdef SAFETY should really
be #ifdef DIAGNOSTIC
 1.36  03-Jan-2009  dholland branches: 1.36.2;
Clarify a comment
 1.35  30-Jan-2008  ad branches: 1.35.6; 1.35.10; 1.35.18; 1.35.20;
Replace struct lock on vnodes with a simpler lock object built on
krwlock_t. This is a step towards removing lockmgr and simplifying
vnode locking. Discussed on tech-kern.
 1.34  02-Jan-2008  ad Merge vmlocking2 to head.
 1.33  22-Dec-2007  dyoung Bug fix: at the top of layer_bypass(), save a pointer to the mount
point for re-use at the bottom, instead of trying to re-read the
mount point from a potentially vrele()'d vnode.
 1.32  10-Oct-2007  ad branches: 1.32.4; 1.32.6; 1.32.10;
Merge from vmlocking:

- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
 1.31  16-Apr-2007  enami branches: 1.31.6; 1.31.8; 1.31.10;
Don't expand RCS id of ancestor file. The id itself is actually copied
from null_vnops.c since the log message of rev. 1.1 implies the copy.
 1.30  16-Apr-2007  chs define a pager flag PGO_RECLAIM, similar to FSYNC_RECLAIM, and use it
to skip unnecessary flushing when layered file system vnodes are recycled.
this also prevents a deadlock with the dodgy LFS putpages routine.
fixes the non-LFS part of PR 36150.
 1.29  09-Dec-2006  chs branches: 1.29.2; 1.29.6; 1.29.8;
a smorgasbord of improvements to vnode locking and path lookup:
- LOCKPARENT is no longer relevant for lookup(), relookup() or VOP_LOOKUP().
these now always return the parent vnode locked. namei() works as before.
lookup() and various other paths no longer acquire vnode locks in the
wrong order via vrele(). fixes PR 32535.
as a nice side effect, path lookup is also up to 25% faster.
- the above allows us to get rid of PDIRUNLOCK.
- also get rid of WANTPARENT (just use LOCKPARENT and unlock it).
- remove an assumption in layer_node_find() that all file systems implement
a recursive VOP_LOCK() (unionfs doesn't).
- require that all file systems supply vfs_vptofh and vfs_fhtovp routines.
fill in eopnotsupp() for file systems that don't support being exported
and remove the checks for NULL. (layerfs calls these without checking.)
- in union_lookup1(), don't change refcounts in the ISDOTDOT case, just
adjust which vnode is locked. fixes PR 33374.
- apply fixes for ufs_rename() from ufs_vnops.c rev. 1.61 to ext2fs_rename().
 1.28  25-Nov-2006  elad branches: 1.28.2;
Part of PR/33280: Christian Ehrhardt: If LK_INTERLOCK is set
vp->v_interlock may be unlocked twice: Once explicitly and a second time
implicilty by lockmgr. LK_INTERLOCK is cleared from the variable flags but
not from ap->a_flags which is used with lockmgr. This is not so much of a
problem because there seems to be no call site that actually uses
LK_INTERLOCK with layer_unlock or VOP_UNLOCK.

okay martin@
 1.27  14-May-2006  elad branches: 1.27.8; 1.27.10;
integrate kauth.
 1.26  11-Dec-2005  christos branches: 1.26.4; 1.26.6; 1.26.8; 1.26.10; 1.26.12;
merge ktrace-lwp.
 1.25  30-Aug-2005  xtraeme Remove __P()
 1.24  26-Feb-2005  perry branches: 1.24.4;
nuke trailing whitespace
 1.23  30-Jun-2004  hannken branches: 1.23.4; 1.23.6;
Do LAYERFS_REMOVED for vop_rmdir.

Reviewed by: Bill Studenmund <wrstuden@netbsd.org>
 1.22  19-Jun-2004  yamt layer_islocked: check a status of the lower vnode as well.
 1.21  16-Jun-2004  wrstuden Make sure we actually locked the parent vnode before we clear
PDIRUNLOCK. The whole reason we have the flag is to note (rare)
cases where we are supposed to have the parent directory locked
but don't. Permits error handling code to know what to do with
the parrent vnode (vrele() vs vput()).
 1.20  16-Jun-2004  yamt - eliminate gratuitous differences between umap_bypass() and layer_bypass().
- fix a typo in a comment.
no functional changes are intended.
 1.19  16-Jun-2004  yamt missing error recover from layer_node_create failure.
 1.18  11-Jun-2004  yamt umap_lookup/layer_lookup: NULL out *ap->a_vpp after calling
underlying filesystem because some caller including lookup()
assume that *vpp is NULL on error.
 1.17  07-Jun-2004  yamt do a LAYERFS_REMOVED hack for vop_rename as well.
 1.16  28-May-2004  wrstuden Since VOP_UPCALL() has been a long time in coming, add this partial
fix for layered-file-removal. It will work for the case of accessing
and deleting a file through the layered file system. Accessing via
the layer and deleting on the underlying still won't work, nor will
accessing via complicated structures (like two umap layers over a
given file systems).

We still need VOP_UPCALL(), but this is better than things were before.

This patch has been discussed off & on for a while. This incarnation
was tested by hannken at netbsd dot org.
 1.15  21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.14  25-Jan-2004  hannken branches: 1.14.2;
Make VOP_STRATEGY(bp) a real VOP as discussed on tech-kern.

VOP_STRATEGY(bp) is replaced by one of two new functions:

- VOP_STRATEGY(vp, bp) Call the strategy routine of vp for bp.
- DEV_STRATEGY(bp) Call the d_strategy routine of bp->b_dev for bp.

DEV_STRATEGY(bp) is used only for block-to-block device situations.
 1.13  30-Nov-2003  wiz Typo fixes in comments from jmc@openbsd.
 1.12  17-Nov-2003  wiz Various typo fixes from Jonathon Gray via jmc@openbsd.
 1.11  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.10  06-Dec-2001  chs branches: 1.10.16;
add VOP_GETPAGES and VOP_PUTPAGES methods for layered filesystems.
drop the interlock on the upper layer, acquire the interlock on the
lower layer.
 1.9  15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.8  10-Nov-2001  lukem add RCSIDs
 1.7  24-Jul-2001  assar branches: 1.7.4;
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.6  07-Jun-2001  wiz branches: 1.6.2;
Typos in comments (misc/13133 by Michael K. Sanders)
 1.5  21-Dec-2000  enami branches: 1.5.2;
Don't cache a device vnode in a layer node cache once the layer node
is inactivated. Otherwise, the device won't closed.
 1.4  19-Sep-2000  fvdl Adapt for VOP_FSYNC parameter change.
 1.3  30-Mar-2000  augustss branches: 1.3.4;
Register, begone!
 1.2  13-Mar-2000  soren Fix doubled 'the's in comments.
 1.1  08-Jul-1999  wrstuden branches: 1.1.2; 1.1.4;
Introduce layer library in genfs. This set of files abstracts most of
the functionality of nullfs. The latter is now just a mount & unmount
routine, and a few tables. umapfs borrow most of this infrastructure.

Both fs's are now nfs-exportable.

All layered fs's share a common format to private mount & private
vnode structs (which a particular fs can extend).

Also add genfs_noerr_rele(), a vnode op which will vrele/vput
operand vnodes appropriately.
 1.1.4.2  05-Jan-2001  bouyer Sync with HEAD
 1.1.4.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.1.2.2  02-Aug-1999  thorpej Update from trunk.
 1.1.2.1  08-Jul-1999  thorpej file layer_vnops.c was added on branch chs-ubc2 on 1999-08-02 22:27:34 +0000
 1.3.4.1  14-Dec-2000  he Pull up revision 1.4 (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.5.2.4  08-Jan-2002  nathanw Catch up to -current.
 1.5.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.5.2.2  24-Aug-2001  nathanw Catch up with -current.
 1.5.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.6.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.1  03-Aug-2001  lukem update to -current
 1.7.4.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.10.16.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.16.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.16.4  27-Oct-2004  skrll Fix various comments that describe the argument structures
 1.10.16.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.16.2  18-Sep-2004  skrll Sync with HEAD.
 1.10.16.1  03-Aug-2004  skrll Sync with HEAD
 1.14.2.4  02-Jul-2004  he Pull up revision 1.23 (requested by hannken in ticket #575):
Do LAYERFS_REMOVED for vop_rmdir.
 1.14.2.3  21-Jun-2004  tron Pull up revision 1.18 (requested by yamt in ticket #514):
umap_lookup/layer_lookup: NULL out *ap->a_vpp after calling
underlying filesystem because some caller including lookup()
assume that *vpp is NULL on error.
 1.14.2.2  21-Jun-2004  tron Pull up revision 1.17 (requested by yamt in ticket #512):
do a LAYERFS_REMOVED hack for vop_rename as well.
 1.14.2.1  30-May-2004  tron Pull up revision 1.16 (requested by wrstuden in ticket #424):
Since VOP_UPCALL() has been a long time in coming, add this partial
fix for layered-file-removal. It will work for the case of accessing
and deleting a file through the layered file system. Accessing via
the layer and deleting on the underlying still won't work, nor will
accessing via complicated structures (like two umap layers over a
given file systems).
We still need VOP_UPCALL(), but this is better than things were before.
This patch has been discussed off & on for a while. This incarnation
was tested by hannken at netbsd dot org.
 1.23.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.23.4.1  29-Apr-2005  kent sync with -current
 1.24.4.6  04-Feb-2008  yamt sync with head.
 1.24.4.5  21-Jan-2008  yamt sync with head
 1.24.4.4  27-Oct-2007  yamt sync with head.
 1.24.4.3  03-Sep-2007  yamt sync with head.
 1.24.4.2  30-Dec-2006  yamt sync with head.
 1.24.4.1  21-Jun-2006  yamt sync with head.
 1.26.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.26.10.2  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.26.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.26.8.1  24-May-2006  yamt sync with head.
 1.26.6.1  01-Jun-2006  kardel Sync with head.
 1.26.4.1  09-Sep-2006  rpaulo sync with head
 1.27.10.1  10-Dec-2006  yamt sync with head.
 1.27.8.1  12-Jan-2007  ad Sync with head.
 1.28.2.3  14-Nov-2012  riz Pull up following revision(s) (requested by dholland in ticket #1466):
sys/kern/vfs_lookup.c: revision 1.195
sys/miscfs/genfs/layer_vnops.c: revision 1.51
In layer_lookup(), clear *vpp before returning EROFS, as otherwise a
stale value can be returned and this causes a diagnostic panic in
namei.
In relookup(), clear *vpp before calling VOP_LOOKUP, as is done in
lookup_once(), as an additional precautionary measure.
(in theory both of these fixes are not required together)
Should fix PR 47040.
 1.28.2.2  16-Apr-2007  bouyer branches: 1.28.2.2.6;
Pull up following revision(s) (requested by chs in ticket #577):
sys/kern/vfs_subr.c: revision 1.287
sys/fs/union/union_vnops.c: revision 1.20
sys/miscfs/genfs/layer_vnops.c: revision 1.30
sys/uvm/uvm_pager.h: revision 1.35
define a pager flag PGO_RECLAIM, similar to FSYNC_RECLAIM, and use it
to skip unnecessary flushing when layered file system vnodes are recycled.
this also prevents a deadlock with the dodgy LFS putpages routine.
fixes the non-LFS part of PR 36150.
 1.28.2.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.28.2.2.6.1  14-Nov-2012  riz Pull up following revision(s) (requested by dholland in ticket #1466):
sys/kern/vfs_lookup.c: revision 1.195
sys/miscfs/genfs/layer_vnops.c: revision 1.51
In layer_lookup(), clear *vpp before returning EROFS, as otherwise a
stale value can be returned and this causes a diagnostic panic in
namei.
In relookup(), clear *vpp before calling VOP_LOOKUP, as is done in
lookup_once(), as an additional precautionary measure.
(in theory both of these fixes are not required together)
Should fix PR 47040.
 1.29.8.1  11-Jul-2007  mjf Sync with head.
 1.29.6.4  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.29.6.3  15-Jul-2007  ad Sync with head.
 1.29.6.2  08-Jun-2007  ad Sync with head.
 1.29.6.1  13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.29.2.1  07-May-2007  yamt sync with head.
 1.31.10.1  14-Oct-2007  yamt sync with head.
 1.31.8.3  23-Mar-2008  matt sync with HEAD
 1.31.8.2  09-Jan-2008  matt sync with HEAD
 1.31.8.1  06-Nov-2007  matt sync with HEAD
 1.31.6.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.32.10.1  02-Jan-2008  bouyer Sync with HEAD
 1.32.6.5  26-Dec-2007  ad Sync with head.
 1.32.6.4  12-Dec-2007  ad Correct a comment.
 1.32.6.3  10-Dec-2007  ad - Don't drain the vnode lock in vclean(); reference counting and XLOCK
should be enough.
- LK_SETRECURSE is gone.
 1.32.6.2  06-Dec-2007  ad - layer_node_find: fix a race.
- Use kmem_alloc/free.
 1.32.6.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.32.4.1  18-Feb-2008  mjf Sync with HEAD.
 1.35.20.1  06-Nov-2012  riz Pull up following revision(s) (requested by dholland in ticket #1814):
sys/kern/vfs_lookup.c: revision 1.195
sys/miscfs/genfs/layer_vnops.c: revision 1.51
In layer_lookup(), clear *vpp before returning EROFS, as otherwise a
stale value can be returned and this causes a diagnostic panic in
namei.
In relookup(), clear *vpp before calling VOP_LOOKUP, as is done in
lookup_once(), as an additional precautionary measure.
(in theory both of these fixes are not required together)
Should fix PR 47040.
 1.35.18.3  28-Apr-2009  skrll Sync with HEAD.
 1.35.18.2  03-Mar-2009  skrll Sync with HEAD.
 1.35.18.1  19-Jan-2009  skrll Sync with HEAD.
 1.35.10.3  11-Aug-2010  yamt sync with head.
 1.35.10.2  11-Mar-2010  yamt sync with head
 1.35.10.1  04-May-2009  yamt sync with head.
 1.35.6.1  17-Jan-2009  mjf Sync with HEAD.
 1.36.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.39.4.5  19-May-2011  rmind Implement sharing of vnode_t::v_interlock amongst vnodes:
- Lock is shared amongst UVM objects using uvm_obj_setlock() or getnewvnode().
- Adjust vnode cache to handle unsharing, add VI_LOCKSHARE flag for that.
- Use sharing in tmpfs and layerfs for underlying object.
- Simplify locking in ubc_fault().
- Sprinkle some asserts.

Discussed with ad@.
 1.39.4.4  21-Apr-2011  rmind sync with head
 1.39.4.3  05-Mar-2011  rmind sync with head
 1.39.4.2  03-Jul-2010  rmind sync with head
 1.39.4.1  16-Mar-2010  rmind Change struct uvm_object::vmobjlock to be dynamically allocated with
mutex_obj_alloc(). It allows us to share the locks among UVM objects.
 1.39.2.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.46.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.47.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.50.12.3  03-Dec-2017  jdolecek update from HEAD
 1.50.12.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.50.12.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.50.8.1  18-Nov-2012  msaitoh Pull up following revision(s) (requested by dholland in ticket #664):
sys/kern/vfs_lookup.c: revision 1.195
sys/miscfs/genfs/layer_vnops.c: revision 1.51
In layer_lookup(), clear *vpp before returning EROFS, as otherwise a
stale value can be returned and this causes a diagnostic panic in
namei.
In relookup(), clear *vpp before calling VOP_LOOKUP, as is done in
lookup_once(), as an additional precautionary measure.
(in theory both of these fixes are not required together)
Should fix PR 47040.
 1.50.2.2  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.50.2.1  30-Oct-2012  yamt sync with head
 1.51.2.1  18-May-2014  rmind sync with head
 1.57.2.1  10-Aug-2014  tls Rebase.
 1.58.8.2  26-Apr-2017  pgoyette Sync with HEAD
 1.58.8.1  20-Mar-2017  pgoyette Sync with HEAD
 1.58.4.3  28-Aug-2017  skrll Sync with HEAD
 1.58.4.2  05-Feb-2017  skrll Sync with HEAD
 1.58.4.1  05-Oct-2016  skrll Sync with HEAD
 1.59.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.63.2.1  11-May-2017  pgoyette Sync with HEAD
 1.66.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.67.12.2  29-Feb-2020  ad Sync with head.
 1.67.12.1  19-Jan-2020  ad Set IMNT_SHRLOOKUP and use it for the in-cache case. Need to check what
more can be done with tmpfs though, it can probably do the whole lookup.
 1.67.6.2  21-Apr-2020  martin Sync with HEAD
 1.67.6.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.69.2.1  20-Apr-2020  bouyer Sync with HEAD

RSS XML Feed