Home | History | Annotate | Download | only in deadfs
History log of /src/sys/miscfs/deadfs/dead_vnops.c
RevisionDateAuthorComments
 1.67  26-Oct-2022  riastradh miscfs/deadfs/deadfs.h: New home for deadfs-related externs.

XXX regen sys/kern/vnode_if.c and the others
 1.66  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.65  18-Jul-2021  dholland Abolish all the silly indirection macros for initializing vnode ops tables.

These are things of the form #define foofs_op genfs_op, or #define
foofs_op genfs_eopnotsupp, or similar. They serve no purpose besides
obfuscation, and have gotten cutpasted all over everywhere.
 1.64  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.63  23-Feb-2020  ad branches: 1.63.10;
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.62  20-Feb-2020  riastradh Use vn_bwrite, not genfs_nullop, for VOP_BWRITE.

VOP_BWRITE is responsible for calling biodone; can't just leave it
hanging.

XXX pullup
 1.61  26-Apr-2017  riastradh branches: 1.61.12; 1.61.16; 1.61.18;
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.60  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.59  20-Apr-2015  riastradh branches: 1.59.2; 1.59.4;
Uncomment the argument struct declarations in deadfs.

We don't actually use them, but this is the only way the vop
versioning mechanism flags code that needs changing.
 1.58  20-Apr-2015  riastradh Make VOP_LINK return directory still locked and referenced.

Ride 7.99.10 bump.
 1.57  25-Jul-2014  dholland branches: 1.57.4;
Add VOP_FALLOCATE and VOP_FDISCARD to every vnode ops table I can
find.

The filesystem ones all call genfs_eopnotsupp - right now I am only
implementing the plumbing and we can implement fallocate and/or
fdiscard for files later.

The device ones call spec_fallocate (which is also genfs_eopnotsupp)
and spec_fdiscard, which dispatches to the device-level op.

The fifo ones all call vn_fifo_bypass, which also ends up being
EOPNOTSUPP.
 1.56  27-Feb-2014  hannken branches: 1.56.2;
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.55  27-Feb-2014  hannken Currently dead vnodes still reside on the vnodelist of the file system
they have been removed from.

Create a "dead mount" that takes dead vnodes until they get freed.

Discussed on tech-kern.
 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  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@

Welcome to 6.99.29
 1.52  07-Nov-2013  hannken Add missing operations that unlock or dereference their arguments.

Stop checking for a vnode state change -- dead vnodes never change state.
 1.51  12-Jun-2011  rmind branches: 1.51.2; 1.51.12; 1.51.16;
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.50  17-Dec-2010  yamt branches: 1.50.6;
do minimal locking to make assertions like KASSERT(VOP_ISLOCKED(vp)) happy.
 1.49  02-Jul-2010  hannken LK_INTERLOCK is no longer a valid flag for VOP_LOCK().
 1.48  14-Mar-2009  dsl branches: 1.48.2; 1.48.4;
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.47  25-Jan-2008  ad branches: 1.47.10; 1.47.18; 1.47.24;
Remove VOP_LEASE. Discussed on tech-kern.
 1.46  02-Jan-2008  ad Merge vmlocking2 to head.
 1.45  10-Oct-2007  ad branches: 1.45.4; 1.45.6; 1.45.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.44  29-Jul-2007  ad branches: 1.44.4; 1.44.6; 1.44.8; 1.44.10;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.43  10-Dec-2006  pooka branches: 1.43.6; 1.43.14;
Teach deadfs about vm object locking for getpages. This avoids
errors resulting from situations where we take a page fault for a
vnode which has been converted a deadfs vnode.

wrstuden ok
 1.42  09-Dec-2006  chs 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.41  16-Nov-2006  christos branches: 1.41.2;
__unused removal on arguments; approved by core.
 1.40  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.39  14-May-2006  elad branches: 1.39.8; 1.39.10;
integrate kauth.
 1.38  11-Dec-2005  christos branches: 1.38.4; 1.38.6; 1.38.8; 1.38.10; 1.38.12;
merge ktrace-lwp.
 1.37  02-Nov-2005  yamt merge yamt-vop branch. remove following VOPs.

VOP_BLKATOFF
VOP_VALLOC
VOP_BALLOC
VOP_REALLOCBLKS
VOP_VFREE
VOP_TRUNCATE
VOP_UPDATE
 1.36  30-Aug-2005  xtraeme branches: 1.36.2;
Remove __P()
 1.35  27-Apr-2004  jrf branches: 1.35.12;
First pass for some caddr_t removal and changes to get rid of it where we
no longer use and/or need it

- removed casts from unionfs, deadfs and fdesc
(there are more to hunt down still)
- changed vfs_quotactl args argumet from caddr_t to void *
- changed vfs_quotactl structures/callers to reflect the api change

Compiled fine and ran for about a day. Approved/reviewed by
christos@netbsd.org and gimpy@netbsd.org.
 1.34  25-Jan-2004  hannken 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.33  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.32  06-Dec-2001  chs branches: 1.32.16;
add a VOP_PUTPAGES method for all the filesystems that don't have pages,
just unlock the interlock.
 1.31  10-Nov-2001  lukem add RCSIDs
 1.30  22-Jan-2001  jdolecek branches: 1.30.2; 1.30.4; 1.30.8;
make filesystem vnodeop, specop, fifoop and vnodeopv_* arrays const
 1.29  27-May-2000  thorpej sleep() -> tsleep()
 1.28  30-Mar-2000  augustss Register, begone!
 1.27  12-Dec-1999  sommerfeld Actually nullop is a better idea here
 1.26  08-Dec-1999  sommerfeld one more tweak: placebo for VOP_LEASE
 1.25  08-Dec-1999  sommerfeld Add appropriate VOP_FCNTL handlers to deadfs and specfs ops vectors.
 1.24  18-May-1998  fvdl branches: 1.24.14; 1.24.20;
Since the interlock has been unlocked, also clear LK_INTERLOCK from
a_flags in order to not confuse the layer that is called through
the following VCALL.
 1.23  18-May-1998  pk dead_lock() must unlock `v_interlock'.
 1.22  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.21  13-Oct-1996  christos backout previous kprintf changes
 1.20  10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.19  07-Sep-1996  mycroft Implement poll(2).
 1.18  05-Sep-1996  thorpej Remove some unused variables.
 1.17  01-Sep-1996  mycroft Add a set of generic file system operations that most file systems use.
Also, fix some time stamp bogosities.
 1.16  13-Feb-1996  mycroft GC *_nullop(). Minor nits.
 1.15  13-Feb-1996  mycroft GC dead_nullop().
 1.14  09-Feb-1996  christos miscfs prototype changes
 1.13  10-Apr-1995  mycroft Return EOF for old vnodes of tty devices, rather than EIO.
 1.12  16-Dec-1994  mycroft Remove a_fp.
 1.11  14-Nov-1994  christos fixed struct comment
 1.10  30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.9  29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.8  08-Jun-1994  mycroft Update to 4.4-Lite fs code, with local changes.
 1.7  22-Dec-1993  cgd fix return type of dead_print
 1.6  18-Dec-1993  mycroft Canonicalize all #includes.
 1.5  07-Sep-1993  ws branches: 1.5.2;
Changes to VFS readdir semantics
NFS changes for better cookie support
ISOFS changes for better Rockridge support and support for generation numbers
 1.4  01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.3  27-Jun-1993  andrew branches: 1.3.2;
ANSIfications - removed all implicit function return types and argument
definitions. Ensured that all files include "systm.h" to gain access to
general prototypes. Casts where necessary.
 1.2  20-May-1993  cgd add $Id$ strings, and clean up file headers where necessary
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  01-Mar-1998  fvdl Import 4.4BSD-Lite for reference
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.3.2.1  31-Jul-1993  cgd give names, err, wmesg's, to my "pain" -- i.e. convert sleep() to tsleep()
 1.5.2.1  14-Nov-1993  mycroft Canonicalize all #includes.
 1.24.20.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.24.14.2  11-Feb-2001  bouyer Sync with HEAD.
 1.24.14.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.30.8.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.30.4.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.30.2.2  08-Jan-2002  nathanw Catch up to -current.
 1.30.2.1  14-Nov-2001  nathanw Catch up to -current.
 1.32.16.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.32.16.4  27-Oct-2004  skrll Fix various comments that describe the argument structures
 1.32.16.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.32.16.2  18-Sep-2004  skrll Sync with HEAD.
 1.32.16.1  03-Aug-2004  skrll Sync with HEAD
 1.35.12.6  04-Feb-2008  yamt sync with head.
 1.35.12.5  21-Jan-2008  yamt sync with head
 1.35.12.4  27-Oct-2007  yamt sync with head.
 1.35.12.3  03-Sep-2007  yamt sync with head.
 1.35.12.2  30-Dec-2006  yamt sync with head.
 1.35.12.1  21-Jun-2006  yamt sync with head.
 1.36.2.1  20-Oct-2005  yamt adapt deadfs.
 1.38.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.38.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.38.8.1  24-May-2006  yamt sync with head.
 1.38.6.1  01-Jun-2006  kardel Sync with head.
 1.38.4.1  09-Sep-2006  rpaulo sync with head
 1.39.10.3  18-Dec-2006  yamt sync with head.
 1.39.10.2  10-Dec-2006  yamt sync with head.
 1.39.10.1  22-Oct-2006  yamt sync with head
 1.39.8.2  12-Jan-2007  ad Sync with head.
 1.39.8.1  18-Nov-2006  ad Sync with head.
 1.41.2.2  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.41.2.1  12-Dec-2006  tron Pull up following revision(s) (requested by pooka in ticket #269):
sys/miscfs/deadfs/dead_vnops.c: revision 1.43
Teach deadfs about vm object locking for getpages. This avoids
errors resulting from situations where we take a page fault for a
vnode which has been converted a deadfs vnode.
wrstuden ok
 1.43.14.1  15-Aug-2007  skrll Sync with HEAD.
 1.43.6.6  19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.43.6.5  17-Jun-2007  ad - Increase the number of thread priorities from 128 to 256. How the space
is set up is to be revisited.
- Implement soft interrupts as kernel threads. A generic implementation
is provided, with hooks for fast-path MD code that can run the interrupt
threads over the top of other threads executing in the kernel.
- Split vnode::v_flag into three fields, depending on how the flag is
locked (by the interlock, by the vnode lock, by the file system).
- Miscellaneous locking fixes and improvements.
 1.43.6.4  10-Jun-2007  ad Acquire vp->v_interlock before calling vwait().
 1.43.6.3  13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.43.6.2  13-Apr-2007  ad - Fix a (new) bug where vget tries to acquire freed vnodes' interlocks.
- Minor locking fixes.
 1.43.6.1  13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.44.10.2  29-Jul-2007  ad It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.44.10.1  29-Jul-2007  ad file dead_vnops.c was added on branch matt-mips64 on 2007-07-29 13:31:12 +0000
 1.44.8.1  14-Oct-2007  yamt sync with head.
 1.44.6.3  23-Mar-2008  matt sync with HEAD
 1.44.6.2  09-Jan-2008  matt sync with HEAD
 1.44.6.1  06-Nov-2007  matt sync with HEAD
 1.44.4.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.45.10.1  02-Jan-2008  bouyer Sync with HEAD
 1.45.6.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.45.4.1  18-Feb-2008  mjf Sync with HEAD.
 1.47.24.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.47.18.1  28-Apr-2009  skrll Sync with HEAD.
 1.47.10.2  11-Aug-2010  yamt sync with head.
 1.47.10.1  04-May-2009  yamt sync with head.
 1.48.4.3  05-Mar-2011  rmind sync with head
 1.48.4.2  03-Jul-2010  rmind sync with head
 1.48.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.48.2.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.50.6.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.51.16.1  18-May-2014  rmind sync with head
 1.51.12.2  03-Dec-2017  jdolecek update from HEAD
 1.51.12.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.51.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.56.2.1  10-Aug-2014  tls Rebase.
 1.57.4.2  28-Aug-2017  skrll Sync with HEAD
 1.57.4.1  06-Jun-2015  skrll Sync with HEAD
 1.59.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.59.2.1  26-Apr-2017  pgoyette Sync with HEAD
 1.61.18.1  29-Feb-2020  ad Sync with head.
 1.61.16.1  21-Mar-2020  martin Pull up following revision(s) (requested by riastradh in ticket #789):

sys/miscfs/deadfs/dead_vnops.c: revision 1.62

Use vn_bwrite, not genfs_nullop, for VOP_BWRITE.
VOP_BWRITE is responsible for calling biodone; can't just leave it
hanging.

XXX pullup
 1.61.12.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.63.10.1  01-Aug-2021  thorpej Sync with HEAD.

RSS XML Feed