Home | History | Annotate | Download | only in genfs
History log of /src/sys/miscfs/genfs/genfs_vnops.c
RevisionDateAuthorComments
 1.220  03-Mar-2023  hannken Fix genfs_can_chtimes() to also handle the condition:

If the time pointer is null, then write permission
on the file is also sufficient.

From FreeBSD.

Should fix PR kern/57246 "NFS group permissions regression"
 1.219  27-Mar-2022  christos branches: 1.219.4;
dedup the eofs link/symlink methods
 1.218  27-Mar-2022  christos Expose groupmember as kauth_cred_groupmember and use it.
 1.217  19-Mar-2022  hannken Remove now unused genfs_nolock(), genfs_nounlock() and genfs_noislocked().
 1.216  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.215  11-Oct-2021  thorpej Mark the EVFILT_VNODE filters MP-safe.
 1.214  11-Oct-2021  thorpej Setting EV_EOF requires modifying kn->kn_flags. However, that relies on
holding the kq_lock of that note's kq. Rather than exposing this directly,
add new knote_set_eof() and knote_clear_eof() functions that handle the
necessary locking and don't leak as many implementation details to modules.

NetBSD 9.99.91
 1.213  10-Oct-2021  thorpej Must hold kn->kn_kq->kq_lock to modify kn->kn_flags.
 1.212  26-Sep-2021  thorpej Change the kqueue filterops::f_isfd field to filterops::f_flags, and
define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd.
Field and flag name aligned with OpenBSD.

This does not constitute a functional or ABI change, as the field location
and size, and the value placed in that field, are the same as the previous
code, but we're bumping __NetBSD_Version__ so 3rd-party module source code
can adapt, as needed.

NetBSD 9.99.89
 1.211  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.210  05-Sep-2020  riastradh branches: 1.210.6;
Round of uvm.h cleanup.

The poorly named uvm.h is generally supposed to be for uvm-internal
users only.

- Narrow it to files that actually need it -- mostly files that need
to query whether curlwp is the pagedaemon, which should maybe be
exposed by an external header.

- Use uvm_extern.h where feasible and uvm_*.h for things not exposed
by it. We should split up uvm_extern.h but this will serve for now
to reduce the uvm.h dependencies.

- Use uvm_stat.h and #ifdef UVMHIST uvm.h for files that use
UVMHIST(ubchist), since ubchist is declared in uvm.h but the
reference evaporates if UVMHIST is not defined, so we reduce header
file dependencies.

- Make uvm_device.h and uvm_swap.h independently includable while
here.

ok chs@
 1.209  07-Aug-2020  christos accmode should be accmode_t
 1.208  27-Jun-2020  christos Introduce genfs_pathconf() and use it for the default case in all filesystems.
 1.207  20-May-2020  christos Fix EPERM vs EACCES on chtimes (thanks @hannken)
 1.206  18-May-2020  christos remove debugging, it is just clutter.
 1.205  18-May-2020  christos Fix EPERM vs EACCES return.
 1.204  16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.203  25-Apr-2020  christos Allow root to access and modify system space extended attributes.
XXX: this routine should not be using the string, but the attribute namespace.
I have fixed this in the ACL code.
 1.202  23-Feb-2020  ad Merge from ad-namecache:

- Have a stab at clustering the members of vnode_t and vnode_impl_t in a
more cache-conscious way. With that done, go back to adjusting v_usecount
with atomics and keep vi_lock directly in vnode_impl_t (saves KVA).

- Allow VOP_LOCK(LK_NONE) for the benefit of VFS_VGET() and VFS_ROOT().
Make sure LK_UPGRADE always comes with LK_NOWAIT.

- Make cwdinfo use mostly lockless.
 1.201  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.200  01-Dec-2019  ad branches: 1.200.2;
Minor vnode locking changes:

- Stop using atomics to maniupulate v_usecount. It was a mistake to begin
with. It doesn't work as intended unless the XLOCK bit is incorporated in
v_usecount and we don't have that any more. When I introduced this 10+
years ago it was to reduce pressure on v_interlock but it doesn't do that,
it just makes stuff disappear from lockstat output and introduces problems
elsewhere. We could do atomic usecounts on vnodes but there has to be a
well thought out scheme.

- Resurrect LK_UPGRADE/LK_DOWNGRADE which will be needed to work effectively
when there is increased use of shared locks on vnodes.

- Allocate the vnode lock using rw_obj_alloc() to reduce false sharing of
struct vnode.

- Put all of the LRU lists into a single cache line, and do not requeue a
vnode if it's already on the correct list and was requeued recently (less
than a second ago).

Kernel build before and after:

119.63s real 1453.16s user 2742.57s system
115.29s real 1401.52s user 2690.94s system
 1.199  25-Oct-2017  maya branches: 1.199.4;
Use C99 initializer for filterops

Mostly done with spatch with touchups for indentation

@@
expression a;
identifier b,c,d;
identifier p;
@@
const struct filterops p =
- { a, b, c, d
+ {
+ .f_isfd = a,
+ .f_attach = b,
+ .f_detach = c,
+ .f_event = d,
};
 1.198  01-Jul-2017  christos Provide EVFILT_WRITE; this is what FreeBSD does and go wants it.
Makes go unit tests pass.
 1.197  04-Jun-2017  hannken Locking a layer vnode using the regular bypass routine is no longer
racy. Undo the change from 2017-03-30 11:16:52, commitid eurqbzuGxGRlryLz
and make vi_lock a krwlock_t again.
 1.196  04-Jun-2017  hannken Now that FSTRANS is part of VOP_*LOCK() remove FSTRANS and vdead_check()
from genfs_.*lock() and assert the vnode state once the vnode is locked.
 1.195  11-Apr-2017  riastradh branches: 1.195.4;
Eliminate now-unused WILLUNLOCK vop flag.
 1.194  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.193  11-Jan-2017  hannken branches: 1.193.2;
Move vnode member v_lock as vi_lock to vnode_impl.h.
 1.192  24-Mar-2014  hannken branches: 1.192.4; 1.192.6; 1.192.8; 1.192.10; 1.192.14;
- 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.191  12-Mar-2014  hannken Restructure genfs_deadlock() and genfs_lock() to always lock before
testing for dead node. Use ISSET() to test flags, add assertions.

Save the mount for fstrans_done() before genfs_unlock() unlocks the node.
 1.190  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.189  30-Mar-2012  njoly branches: 1.189.2; 1.189.4;
uid mismatch for file flags changes is expected to fail with EPERM not
EACCES.
 1.188  13-Mar-2012  elad Replace the remaining KAUTH_GENERIC_ISSUSER authorization calls with
something meaningful. All relevant documentation has been updated or
written.

Most of these changes were brought up in the following messages:

http://mail-index.netbsd.org/tech-kern/2012/01/18/msg012490.html
http://mail-index.netbsd.org/tech-kern/2012/01/19/msg012502.html
http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012728.html

Thanks to christos, manu, njoly, and jmmv for input.

Huge thanks to pgoyette for spinning these changes through some build
cycles and ATF.
 1.187  12-Jun-2011  rmind branches: 1.187.2; 1.187.6;
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.186  27-Dec-2010  hannken branches: 1.186.6;
Extend the range of fstrans transactions to a sequence of vnode operations
on a locked vnode. This leaves a suspended file system and therefore a
snapshot with either all or no operations of such a sequence done.
 1.185  30-Nov-2010  dholland Abolish the SAVENAME and HASBUF flags. There is now always a buffer,
so the path in a struct componentname is now always valid during VOP
calls.
 1.184  30-Nov-2010  dholland Abolish struct componentname's cn_pnbuf. Use the path buffer in the
pathbuf object passed to namei as work space instead. (For now a pnbuf
pointer appears in struct nameidata, to support certain unclean things
that haven't been fixed yet, but it will be going away in the future.)

This removes the need for the SAVENAME and HASBUF namei flags.
 1.183  01-Sep-2010  chs replace the earlier workaround for PR 40389 with a better fix.
the earlier change caused data corruption by freeing pages
without invaliding their mappings. instead of the trylock/retry,
just take the genfs-node lock before calling VOP_GETPAGES()
and pass a new flag to tell it that we're already holding this lock.
 1.182  01-Jul-2010  hannken Remove vlockmgr(). Generic vnode lock operations now use a rwlock located
in the vnode. All LK_* flags move from sys/lock.h to sys/vnode.h. Calls
to vlockmgr() in file systems get replaced with VOP_LOCK() or VOP_UNLOCK().

Welcome to 5.99.34.

Discussed on tech-kern.
 1.181  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.180  24-Jun-2010  hannken genfs_nolock(): LK_INTERLOCK flag no longer possible.
 1.179  24-Jun-2010  hannken Clean up vnode lock operations:

- VOP_LOCK(vp, flags): Limit the set of allowed flags to LK_EXCLUSIVE,
LK_SHARED and LK_NOWAIT. LK_INTERLOCK is no longer allowed as it
makes no sense here.

- VOP_ISLOCKED(vp): Remove the for some time unused return value
LK_EXCLOTHER. Mark this operation as "diagnostic only".
Making a lock decision based on this operation is no longer allowed.

Discussed on tech-kern.
 1.178  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.177  08-Apr-2010  pooka Call VOP_ABORTOP in genfs_eopnotsupp. This prevents file system
authors from having to get down on their knees and pray they won't
get POGA'd(*) again.

This plugs componentname leaks in at least smbfs and buggy puffs
servers (buggy servers shouldn't be able to leak kernel memory).

*) principle of greatest astonishment
 1.176  27-Jan-2010  uebayasi branches: 1.176.2; 1.176.4;
Don't forget to tell the result of rw_tryenter().
 1.175  27-Jan-2010  uebayasi Add genfs_node_rdtrylock().
 1.174  20-Nov-2009  roy Allow chown if caller is in the new group.
 1.173  20-Nov-2009  pooka Disallow chown for files the caller does not own.
 1.172  23-Jun-2009  elad Move the implementation of vaccess() to genfs_can_access(), in line with
the other routines of the same spirit.

Adjust file-system code to use it.

Keep vaccess() for KPI compatibility and to keep element of least
surprise. A "diagnostic" message warning that vaccess() is deprecated will
be printed when it's used (obviously, only in DIAGNOSTIC kernels).

No objections on tech-kern@:

http://mail-index.netbsd.org/tech-kern/2009/06/21/msg005310.html
 1.171  07-May-2009  elad Extract the open-coded authorization logic for chtimes() from various
file-systems and put it in a single function, genfs_can_chtimes().

This also makes UDF follow the same policy as all other file-systems.

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004951.html
 1.170  25-Apr-2009  elad Add genfs_can_mount() and use it to prevent some more code duplication of
the security checks when mounting a device (VOP_ACCESS() + kauth(9) call)).

Proposed with no objections on tech-kern@:

http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004859.html

The vnode is always expected to be locked, so no locking is done outside
the file-system code.
 1.169  22-Apr-2009  elad Per discussion on tech-kern@:

- Replace use of label/goto with returns

- Rename, change prototype of, and move functions from vfs_subr.c to
genfs_vnops.c
 1.168  18-Apr-2009  pooka Move genfs_null_putpages() from genfs_io.c to genfs_vnops.c -- it does
not really do i/o.
 1.167  28-Apr-2008  martin branches: 1.167.8; 1.167.10; 1.167.14; 1.167.16; 1.167.18;
Remove clause 3 and 4 from TNF licenses
 1.166  19-Apr-2008  hannken branches: 1.166.2;
Remove stale include <sys/fstrans.h>.
 1.165  21-Mar-2008  ad branches: 1.165.2;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.164  05-Feb-2008  ad branches: 1.164.6;
Lock v_knlist with the vnode interlock. PR kern/37881.
 1.163  30-Jan-2008  ad 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.162  25-Jan-2008  riz Since VOP_LEASE is gone, remove genfs_lease_check() too. Now my kernel
builds again. :)
 1.161  17-Jan-2008  ad Fix v_freelisthd assertion failure during call to vdevdone(). No calling
VOPs without a vnode reference!
 1.160  02-Jan-2008  ad Merge vmlocking2 to head.
 1.159  05-Dec-2007  pooka branches: 1.159.4;
Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.
 1.158  17-Oct-2007  pooka branches: 1.158.4; 1.158.6;
Split I/O-related routines (getpages, putpages, etc.) which are heavily
tied to uvm out of genfs_vnops into genfs_io.c
 1.157  10-Oct-2007  ad 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.156  29-Jul-2007  ad branches: 1.156.4; 1.156.6; 1.156.8; 1.156.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.155  09-Jul-2007  ad branches: 1.155.2;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.154  05-Jun-2007  yamt improve post-ubc file overwrite performance in common cases.
ie. when it's safe, actually overwrite blocks rather than doing
read-modify-write.

also fixes PR/33152 and PR/36303.
 1.153  17-May-2007  hannken Fstrans_start() always returns zero, so change its type to void.
 1.152  13-May-2007  yamt use a cached value of v_size. no functional changes.
 1.151  24-Apr-2007  perseant Split the VOP interface part of genfs_putpages() from the code. The new
function that does the work, genfs_do_putpages(), now takes as an argument
a pointer to the page that would be waited on, if PGO_BUSYWAIT were not set.
This allows a consumer, e.g. lfs_putpages(), to perform an action outside
the scope of UVM before sleeping on the page in question.
 1.150  04-Mar-2007  christos branches: 1.150.2; 1.150.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.149  22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.148  21-Feb-2007  thorpej Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.147  20-Feb-2007  ad Add genfs_node_destroy(). Fixes a lock "leak" seen when running LOCKDEBUG
kernels.
 1.146  15-Feb-2007  ad branches: 1.146.2;
Replace some uses of lockmgr() / simplelocks.
 1.145  09-Feb-2007  ad Merge newlock2 to head.
 1.144  29-Jan-2007  hannken Change fstrans enum types to upper case.
No functional change.

From Antti Kantee <pooka@netbsd.org>
 1.143  19-Jan-2007  hannken New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE. This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).
 1.142  27-Dec-2006  yamt remove nqnfs.
 1.141  15-Dec-2006  yamt put ->K loaned pages on the page queue, so that page loaning doesn't
disturb pagedaemon/pdpolicy.
 1.140  30-Nov-2006  pooka branches: 1.140.2; 1.140.4;
* update comments before putpages(): the vm object is always returned
unlocked instead of locked. chuq agrees
* use slock set to &uobj->vmobjlock also for the last simple lock
operation to be consistent with the rest of the function
 1.139  25-Nov-2006  christos instead of const int, use a #define which most of the time will evaluate
in a compile-time constant.
 1.138  16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.137  20-Oct-2006  reinoud Replace the LIST structure mp->mnt_vnodelist to a TAILQ structure since all
vnodes were synced and processed backwards. This meant that the last
accessed node was processed first and the earlierst last.

An extra benefit is the removal of the ugly hack from the Berkly days on
LFS.

In the proces, i've also replaced the various variations hand written loops
by the TAILQ_FOREACH() macro's.
 1.136  14-Oct-2006  yamt add wrapper functions of lockmgr on g_glock.
 1.135  14-Oct-2006  yamt genfs_getpages: use kmem_zalloc.
 1.134  14-Oct-2006  yamt genfs_do_io: iodone handler should be called at splbio.
 1.133  12-Oct-2006  yamt genfs_putpages: don't try to deactivate loaned pages.
reported and tested by Nicolas Joly on current-users@.
 1.132  12-Oct-2006  thorpej genfs_lease_check(): Consume the arguments even if NFSSERVER is not defined.
 1.131  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.130  05-Oct-2006  chs add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).
 1.129  15-Sep-2006  yamt branches: 1.129.2;
merge yamt-pdpolicy branch.
- separate page replacement policy from the rest of kernel
- implement an alternative replacement policy
 1.128  23-Jul-2006  ad branches: 1.128.4;
Use the LWP cached credentials where sane.
 1.127  22-Jul-2006  yamt - genfs_getpages: in the case of PGO_LOCKED, check if we can acquire
g_glock as suggested by Chuck Silvers on tech-kern@.
- genfs_rel_pages: handle PGO_DONTCARE so that it can be used for the above.
 1.126  22-Jul-2006  yamt - in genfs_getpages, take g_glock earlier so that it can't be
intervened by truncation.
it also fixes a deadlock. (g_glock vs pages locking order)
- uvm_vnp_setsize: modify v_size while holding v_interlock.

reviewed by Chuck Silvers.
 1.125  14-May-2006  elad integrate kauth.
 1.124  11-Apr-2006  yamt genfs_getpages:
- use "overwrite" variable consistently.
- remove a set-only variable.
no functional changes.
 1.123  30-Mar-2006  yamt some cleanups after the introduction of GOP_SIZE_MEM flag.
- remove GOP_SIZE_READ/GOP_SIZE_WRITE flags.
they have not been used since the change.
- ufs_balloc_range: remove code which has been no-op since the change.
thanks Konrad Schroder for explaining the original intention of the code.
- ffs_gop_size: don't extend past eof, in the case of GOP_SIZE_MEM.
otherwise genfs_getpages end up to allocate pages past eof unnecessarily.
 1.122  01-Mar-2006  yamt branches: 1.122.2; 1.122.4; 1.122.6;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.121  16-Jan-2006  reinoud branches: 1.121.2; 1.121.4;
Add genfs support for directories and softlinks next to regular files and
block devices.

Discussed on tech-kern and ok'd by Chuck
 1.120  11-Jan-2006  yamt use nestiobuf api for genfs.
 1.119  04-Jan-2006  yamt - add simple functions to allocate/free a buffer for i/o.
- make bufpool static.
 1.118  24-Dec-2005  perry branches: 1.118.2;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.117  15-Dec-2005  yamt fix lock/unlock mismatch in rev.1.115.
reported by Chris Tribo on current-users@.
 1.116  11-Dec-2005  christos merge ktrace-lwp.
 1.115  03-Dec-2005  yamt genfs_compat_getpages: add minimum support of async get. ie. ignore them.
should fix a crash reported by Jukka Salmi on current-users@.
 1.114  02-Dec-2005  yamt genfs_gop_write: use devvp directly as genfs_getpages does.
 1.113  02-Dec-2005  yamt genfs_putpages: initialize marker pages only when needed.
 1.112  30-Nov-2005  yamt revert rev.1.111 as it isn't necessary or correct.
- currently no one in tree has a problem with zero b_lblkno, afaik.
- this buf is used for "devvp", so it doesn't make sense to
use lbn in the "vp".
 1.111  30-Nov-2005  reinoud Learn genfs that (struct buf *)->b_lblkno allways need to point to the
logical block number of the file instead of allways zero.
 1.110  29-Nov-2005  yamt merge yamt-readahead branch.
 1.109  12-Nov-2005  yamt branches: 1.109.2;
genfs_getpages:
- add an assertion.
- call VOP_STRATEGY of underlying vnode directly, rather than
through the filesystem vnode.
- no need to set b_dev here because VOP_STRATEGY will take care of it.
 1.108  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.107  07-Oct-2005  elad branches: 1.107.2;
Remove Veriexec bits from genfs, don't #if 0 them.
 1.106  07-Oct-2005  elad Various fixes from blymn@ and myself.

Also, put genfs changes under #if 0, and don't do per-page fingerprints
until this is properly discussed, as requested by yamt@.
 1.105  05-Oct-2005  elad Introduce per-page fingerprints in Veriexec.

This closes a hole pointed out by Thor Lancelot Simon on tech-kern ~3
years ago.

The problem was with running binaries from remote storage, where our
kernel (and Veriexec) has no control over any changes to files.

An attacker could, after the fingerprint has been verified and
program loaded to memory, inject malicious code into the backing
store on the remote storage, followed by a forced flush, causing
a page-in of the malicious data from backing store, bypassing
integrity checks.

Initial implementation by Brett Lymn.
 1.104  26-Jul-2005  yamt don't write-protect wired pages. pointed by Chuck Silvers.
for now, leave a vnode on the syncer's queue, as suggested by him.
 1.103  23-Jul-2005  yamt update file timestamps for nfsd loaned-read and mmap.
PR/25279. discussed on tech-kern@.
 1.102  17-Jul-2005  yamt genfs_putpages: don't bother to clean the vnode unless VONWORKLST.
 1.101  17-Jul-2005  yamt ensure that vnodes with dirty pages are always on syncer's queue.

- genfs_putpages: wait for i/o completion of PG_RELEASED/PG_PAGEOUT pages by
setting "wasclean" false when encountering them.
suggested by Stephan Uphoff in PR/24596 (1).

- genfs_putpages: write protect pages when cleaning out, if
we're going to take the vnode off the syncer's queue.
uvm_fault: don't write-map pages unless its vnode is already on
the syncer's queue.

fix PR/24596 (3) but in the different way from the suggested fix.
(to keep our current behaviour, ie. not to require explicit msync.
discussed on tech-kern@.)

- genfs_putpages: don't mistakenly take a vnode off the queue
by introducing a generation number in genfs_node.
genfs_getpages: increment the generation number.
suggested by Stephan Uphoff in PR/24596 (2).

- add some assertions.
 1.100  17-Jul-2005  yamt - introduce PGO_NOBLOCKALLOC and use it for ubc mapping
to prevent unnecessary block allocations in the case that
page size > block size.

- ufs_balloc_range: use VM_PROT_WRITE+PGO_NOBLOCKALLOC rather than
VM_PROT_READ.
 1.99  16-Jul-2005  yamt genfs_getpages: don't forget to put the vnode onto the syncer's work queue
even in the case of PGO_LOCKED.
 1.98  28-Jun-2005  yamt branches: 1.98.2;
- constify genfs_ops.
- use member designators.
 1.97  29-May-2005  christos - sprinkle const
- avoid shadowed variables.
 1.96  26-Feb-2005  perry branches: 1.96.2;
nuke trailing whitespace
 1.95  16-Feb-2005  chs undo the part of rev. 1.93 that turned the past-EOF check into an assertion.
read() can't request pages past EOF, but mmap() can. apparently I had
disengaged the brain when I said that was ok.
 1.94  25-Jan-2005  wrstuden Extend fsync_range(2) to support the FDISKSYNC flag, which requests
that the sync be propogated out through the disk drive caches.
 1.93  25-Jan-2005  drochner branches: 1.93.2;
-in the read-ahead code, avoid to issue read requests at/past EOF
-because noone should request reads past EOF, or writes past EOF which
are not explicitely marked as file-extending (PGO_PASTEOF), turn
a boundary check into a KASSERT
approved by Chuck Silvers
 1.92  22-Dec-2004  dbj branches: 1.92.2;
check for _KERNEL_OPT around opt include
 1.91  04-Oct-2004  enami Backout previous; seeing many busy page on the pageq is normal.
 1.90  03-Oct-2004  enami So that not to leave pages busy unnecessarily, bound to specified region
when building cluster if we aren't pagedaemon and clean entire cluster
if we are pagedaemon.
 1.89  03-Oct-2004  enami Count obj pages freed by pagedaemon.
 1.88  17-Sep-2004  skrll There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
 1.87  27-May-2004  yamt - remove a comment which is no longer true.
- add "XXX vn_lock" comments where we can call VOP_READ/WRITE
without vnode lock held. (genfs_compat_*)
 1.86  25-May-2004  hannken Add ffs internal snapshots. Written by Marshall Kirk McKusick for FreeBSD.

- Not enabled by default. Needs kernel option FFS_SNAPSHOT.
- Change parameters of ffs_blkfree.
- Let the copy-on-write functions return an error so spec_strategy
may fail if the copy-on-write fails.
- Change genfs_*lock*() to use vp->v_vnlock instead of &vp->v_lock.
- Add flag B_METAONLY to VOP_BALLOC to return indirect block buffer.
- Add a function ffs_checkfreefile needed for snapshot creation.
- Add special handling of snapshot files:
Snapshots may not be opened for writing and the attributes are read-only.
Use the mtime as the time this snapshot was taken.
Deny mtime updates for snapshot files.
- Add function transferlockers to transfer any waiting processes from
one lock to another.
- Add vfsop VFS_SNAPSHOT to take a snapshot and make it accessible through
a vnode.
- Add snapshot support to ls, fsck_ffs and dump.

Welcome to 2.0F.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
 1.85  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.84  10-Jan-2004  yamt store a i/o priority hint in struct buf for buffer queue discipline.
 1.83  27-Nov-2003  pk genfs_revoke: use ltsleep() to release the vnode spin lock to avoid a
sleep/wakeup race.
 1.82  24-Sep-2003  yamt fix a bug of lfs.

genfs_getpages() can read in more blocks than it should due to faked filesize
of lfs_gop_size(). it's a security problem and it makes gcc3 "internal error"

to fix this,
- in genfs_getpages(), always calculate diskeof and memeof separately
so that filesystems (in this case, lfs) can use different strategies
for them.
- introduce GOP_SIZE_MEM flag and use it to request in-core filesize.
(it was an intention of GOP_SIZE_READ,
but after the above change _READ is not a straightforward name)

after this, no one uses GOP_SIZE_{READ,WRITE} anymore but leave them for now.
 1.81  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.80  29-Jun-2003  fvdl branches: 1.80.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.79  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.78  17-Jun-2003  simonb Micro-optimisation- move the "pgs == NULL" check from the previous
change to immediately after the malloc call. This can't fail in
the non-malloc case.

Reviewd by YAMAMOTO Takashi.
 1.77  15-Jun-2003  yamt genfs_getpages: if number of pages requested is >16,
use malloc/free for array of pointers to vm_page.
otherwise, use on-stack array as used to.
this change fixes assertion failure when nfsd gets a big read request
that isn't aligned with filesystem block.
discussed on tech-kern.
 1.76  23-Apr-2003  tls Correct use of MAXBSIZE where MAXPHYS was intended. This is a necessary
first step towards per-device MAXPHYS, and has the beneficial side effect
of allowing clustering to MAXPHYS even on systems that need to run with
a reduced MAXBSIZE to get more metadata buffers.
 1.75  10-Apr-2003  jdolecek use former genfs_eopnotsupp_rele() as genfs_eopnotsupp(), so that vnodes
are vput()/vrele()d as necessary - some filesystems did use the wrong
one for some ops, and it's just safer to not take the chance

based on suggestion by Bill Studenmund
 1.74  10-Apr-2003  jdolecek improve genfs_eopnotsupp_rele() so that's usable for vop_rename,
which uses WILLPUT for member which may be NULL
handle correctly dvp == vp case for WILLPUT members, so this works
for vop_remove, vop_rename

thanks Bill Studenmund for code&comments on this
 1.73  25-Feb-2003  thorpej Add a new BUF_INIT() macro which initializes b_dep and b_interlock, and
use it. This fixes a few places where either b_dep or b_interlock were
not properly initialized.
 1.72  17-Feb-2003  perseant Add code to UBCify LFS. This is still behind "#ifdef LFS_UBC" for now
(there are still some details to work out) but expect that to go
away soon. To support these basic changes (creation of lfs_putpages,
lfs_gop_write, mods to lfs_balloc) several other changes were made, to
wit:

* Create a writer daemon kernel thread whose purpose is to handle page
writes for the pagedaemon, but which also takes over some of the
functions of lfs_check(). This thread is started the first time an
LFS is mounted.

* Add a "flags" parameter to GOP_SIZE. Current values are
GOP_SIZE_READ, meaning that the call should return the size of the
in-core version of the file, and GOP_SIZE_WRITE, meaning that it
should return the on-disk size. One of GOP_SIZE_READ or
GOP_SIZE_WRITE must be specified.

* Instead of using malloc(...M_WAITOK) for everything, reserve enough
resources to get by and use malloc(...M_NOWAIT), using the reserves if
necessary. Use the pool subsystem for structures small enough that
this is feasible. This also obsoletes LFS_THROTTLE.

And a few that are not strictly necessary:

* Moves the LFS inode extensions off onto a separately allocated
structure; getting closer to LFS as an LKM. "Welcome to 1.6O."

* Unified GOP_ALLOC between FFS and LFS.

* Update LFS copyright headers to correct values.

* Actually cast to unsigned in lfs_shellsort, like the comment says.

* Keep track of which segments were empty before the previous
checkpoint; any segments that pass two checkpoints both dirty and
empty can be summarily cleaned. Do this. Right now lfs_segclean
still works, but this should be turned into an effectless
compatibility syscall.
 1.71  05-Feb-2003  pk Make the buffer cache code MP-safe.
 1.70  21-Jan-2003  christos step 3. Assign lwp properly if null, so that we can PHOLD without segfaulting.
 1.69  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.68  15-Nov-2002  yamt genfs_compat_gop_write: set uio_iovcnt correctly.
 1.67  25-Oct-2002  yamt use B_ASYNC for children of nested buffers in genfs_getpages.
ok'ed by Chuck Silvers.
 1.66  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.65  21-Oct-2002  fvdl Use B_ASYNC in the !PGO_SYNCIO case. Gets back most, if not all, NFS
read throughput performance lost since the introduction of UBC. Spotted
by YAMAMOTO Takashi, many thanks to him.
 1.64  29-May-2002  enami Add missing pageq lock while uvm_pagefree() is called (either directly
or indirectly). Reviewed by chuq.
 1.63  18-May-2002  enami branches: 1.63.2;
Just give up to do readahead rather than waiting busy pages.
While I'm here, added few patchable variable so that one can
easily measure readahead behaviour.
 1.62  14-May-2002  perseant branches: 1.62.2;
Protect v_synclist with splbio(); note that LIST_REMOVE is not an idempotent
operation if more than one LIST_REMOVE happens on interrupt, so both the test
for VONWORKLIST and the LIST_REMOVE(vp, v_synclist) need to be in splbio().
 1.61  10-May-2002  enami Redo rev. 1.57 a bit different way; don't use `tpg' since it may be freed.
Subtract the number of pages behind us when calculating new offset instead.
 1.60  10-May-2002  enami Don't modify the local variable `n' in genfs_putpages(). It should contain
the number of elements in the page array at the beginning of every iteration.
 1.59  09-May-2002  enami When traversing by list, if the page next to us is a page in the cluster,
advance the pointer.
 1.58  09-May-2002  enami - In genfs_putpages(), no need to restrict the cluster within the given
region.
- In uvm_aio_aiodone(), remove assertions no longer true.
 1.57  06-May-2002  enami Since npages may includes number of pages behind us, we can't use it to
update current offset. Instead, use the last page in the run of pages
to calculate new offset.
 1.56  06-May-2002  enami Stylistic change; introduce new local variable and use it instead of
sprinkling different expression to test if we're pagedaemon.
 1.55  26-Apr-2002  enami We don't need to re-activate page in genfs_putpages() when GOP_WRITE returns
ENOMEM (temporary memory shortage) since it is already handled in
uvm_aio_aiodone() for both async/sync case. Discussed with chuq.
 1.54  16-Apr-2002  enami genfs_{compat_}getpages(): For PGO_LOCKED request, it is safe to return
read only page if it was due to read fault. This avoid many unnecessary
read fault introduced by recent nfs_bio.c change. Reviewed by chuq.
 1.53  16-Apr-2002  enami KNF and other misc. cosmetic changes.
 1.52  22-Mar-2002  chs in genfs_compat_getpages(), clear any part of a page that
VOP_READ() doesn't fill in (eg. because it's past EOF).
 1.51  17-Mar-2002  atatat Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.50  02-Mar-2002  chs don't yield the cpu in genfs_putpages() if we're the pagedaemon.
pointed out by enami. fixes PR 15784.
 1.49  19-Feb-2002  chs fix two problems:
- when yielding the cpu while using the vnode's page list, use a marker page
to keep our place in the list (like the other cases where we drop the lock).
- wait until no one else has the page busy before deciding if the page needs
to be cleaned. a page will be dirty while it's being initialized but will
be marked clean before PG_BUSY is cleared.
both found by enami.
 1.48  13-Feb-2002  enami Don't bother to subtract 0.
 1.47  12-Feb-2002  enami Don't leave junk in pgs[] array since it will be passed to uvn_findpages()
again.
 1.46  26-Jan-2002  chs in genfs_putpages():
- yield the cpu if we've taken too long.
- when traversing by offset, skip over any pages that we clustered.
 1.45  31-Dec-2001  chs in genfs_gop_write(), actually set the B_ASYNC flag on buffers that we're
not going to wait for. this doesn't matter for real devices since we call
VOP_STRATEGY() directly, but NFS uses this flag to decide whether or not
to hand the buffer off to an nfsiod thread.
 1.44  31-Dec-2001  chs in genfs_putpages(), we must wait for any pending write i/os to complete
if the putpages request is synchronous.
 1.43  18-Dec-2001  chs add some compatibility routines to allow mmap() to work non-UBCified
filesystems (in the same non-coherent fashion that they worked before).
 1.42  06-Dec-2001  chs add a VOP_PUTPAGES method for all the filesystems that don't have pages,
just unlock the interlock.
 1.41  30-Nov-2001  christos PR/14781: Matthew Fredette: Clamp the number of read-ahead pages to 16 because
other code has this limit. Also while I am here, convert the magic 16 into
a #define constant and use it in the appropriate places. This is a temporary
fix, since all this read-ahead business is XXXUBC anyway.
 1.40  10-Nov-2001  lukem add RCSIDs
 1.39  03-Oct-2001  enami branches: 1.39.2;
s/genfs_do_putpages/genfs_gop_write/ in uvmhist.
 1.38  21-Sep-2001  chs when zeroing pages past EOF, don't zero the page containing EOF if it
already contains valid data. should fix PRs 13361 and 13436.
 1.37  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.36  17-Aug-2001  chs branches: 1.36.2;
make genfs get/put work for block devices as well:
- the "fs bshift" for block devices is always DEV_BSHIFT.
- retrieve the device vnode from VOP_BMAP() and use that to set b_dev
in page i/o buffers.
 1.35  14-Jun-2001  chs branches: 1.35.2;
be sure to allocate dirty zeroed pages to cover blocks we allocate
to resolve a write fault. fixes PR 13201.
also, be sure to allocate blocks for write faults to holes even if
the page is already in memory. fixes PR 13189.
 1.34  28-May-2001  chs add a genfs_mmap() and change all of the disk-based filesystems
to implement VOP_MMAP() with the genfs version, in preparation for
actually using this VOP.
 1.33  26-May-2001  chs replace vm_page_t with struct vm_page *.
 1.32  10-Mar-2001  chs eliminate the VM_PAGER_* error codes in favor of the traditional E* codes.
the mapping is:

VM_PAGER_OK 0
VM_PAGER_BAD <unused>
VM_PAGER_FAIL <unused>
VM_PAGER_PEND 0 (see below)
VM_PAGER_ERROR EIO
VM_PAGER_AGAIN EAGAIN
VM_PAGER_UNLOCK EBUSY
VM_PAGER_REFAULT ERESTART

for async i/o requests, it used to be possible for the request to
be convert to sync, and the pager would return VM_PAGER_OK or VM_PAGER_PEND
to indicate whether the caller should perform post-i/o cleanup.
this is no longer allowed; pagers must now return 0 to indicate that
the async i/o was successfully started, and the caller never needs to
worry about doing the post-i/o cleanup.
 1.31  28-Feb-2001  chs branches: 1.31.2;
in genfs_getpages(), don't try to optimize zeroing past EOF.
fixes PR 12297.
 1.30  27-Feb-2001  chs distinguish between a file's in-memory EOF (which marks the offset at
which we disallow creation of page cache pages) and its on-disk EOF
(which marks the offset at which there is not (yet) data on disk that
we need to read when creating pages). for requests with PGO_PASTEOF,
the in-memory EOF maybe be much larger than the on-disk EOF.
 1.29  18-Feb-2001  chs fix a couple more bugs:
- in genfs_getpages(), unbusy any pages that we don't free in the error path.
- in genfs_putpages(), if we get a bmap error, record that in the master buf.
 1.28  12-Feb-2001  fvdl Oops, removal unintenionally commited debug code.
 1.27  12-Feb-2001  fvdl Format arg nit.
 1.26  05-Feb-2001  chs fix several bugs:
- in the cases where we skip over the i/o loop, increment npages by ridx
so that when the cleanup code starts processing the pgs array at index 0
it'll actually process all of the pages.
- process the PG_RELEASED flag when unbusying pages.
- add some missing MP locking.
- use MIN() and MAX() instead of min() and max() since the latter are
functions which take arguments of type "int" but we call them with
values of type "off_t", so the values could be truncated.
- in the PGO_PASTEOF case, use the larger of the current file size and the
end of the requested range of pages as the file size for this request.
this fixes some problems with sparsing writes to large offsets.
 1.25  22-Jan-2001  fvdl Cast lbn to off_t in a few places, to avoid daddr_t overflow and all sorts
of havoc. From Bill Sommerfeld.
 1.24  27-Dec-2000  chs several bugs:
- in genfs_getpages() don't start read-ahead if we get an error on the
sync read, and always start read-ahead after the range of the sync read
if we do any at all.
- off-by-one error in genfs_size().
 1.23  09-Dec-2000  chs only zero the part of the page after EOF if we're actually
initializing the page.
 1.22  27-Nov-2000  chs allow building without SOFTDEP by adding the pageiodone hook to bio_ops.
 1.21  27-Nov-2000  chs Initial integration of the Unified Buffer Cache project.
 1.20  19-Sep-2000  fvdl Adapt for VOP_FSYNC parameter change.
 1.19  03-Aug-2000  thorpej Convert namei pathname buffer allocation to use the pool allocator.
 1.18  29-May-2000  mycroft branches: 1.18.2;
Stylistic change.
 1.17  13-May-2000  perseant branches: 1.17.2;
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.16  30-Mar-2000  augustss Register, begone!
 1.15  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.14  23-Oct-1999  fvdl Remove some mentioned members in the vop {un}lock args struct that we
do not actually have.
 1.13  03-Aug-1999  wrstuden branches: 1.13.2; 1.13.4; 1.13.6;
Add support for fcntl(2) to generate VOP_FCNTL calls. Any fcntl
call with F_FSCTL set and F_SETFL calls generate calls to a new
fileop fo_fcntl. Add genfs_fcntl() and soo_fcntl() which return 0
for F_SETFL and EOPNOTSUPP otherwise. Have all leaf filesystems
use genfs_fcntl().

Reviewed by: thorpej
Tested by: wrstuden
 1.12  08-Jul-1999  wrstuden 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.11  05-Mar-1999  mycroft branches: 1.11.4;
Pass null pointers to VOP_UPDATE rather than having all the callers fetch the
current time themselves.
 1.10  13-Aug-1998  kleink Add genfs_einval(), which does the obvious thing.
 1.9  10-Aug-1998  matthias create miscfs/genfs/genfs_vnops.c:genfs_enoioctl and make all the other
filesystems use it instead of a private version.
 1.8  25-Jun-1998  thorpej - Rename nqnfs_vop_lease_check() to genfs_lease_check(). If NFSSERVER is
not in the kernel, genfs_lease_check() is simply a no-op. This allows
LKM'd file systems to be exported (previously did not work properly
due to a compile-time decision based on -DNFSSERVER).
- defopt NFSSERVER
 1.7  05-Jun-1998  kleink * Convert fsync vnode operator implementations and usage from the old
waitfor argument and MNT_WAIT/MNT_NOWAIT to flags and FSYNC_WAIT.
* In genfs_fsync(), honor the FSYNC_NODATA flag.
 1.6  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.5  05-Jan-1998  perry RCSID Police.
 1.4  11-Apr-1997  kleink Implement a POSIX compliant genfs VOP_SEEK() and use it in the appropriate
places; by Chris G. Demetriou and myself.
 1.3  07-Sep-1996  mycroft Implement poll(2).
 1.2  05-Sep-1996  thorpej Remove some unused variables.
 1.1  01-Sep-1996  mycroft Add a set of generic file system operations that most file systems use.
Also, fix some time stamp bogosities.
 1.11.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.11.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.11.4.5  02-Aug-1999  thorpej Update from trunk.
 1.11.4.4  31-Jul-1999  chs genfs_getpages() now handles:
- faults on offsets past the nominal EOF during extending writes.
- returning multiple pages in the !PGO_LOCKED case if multiple pages
are requested.
- using new VOP_BALLOC() interface to for allocating getpages with
blocksize<pagesize.
genfs_putpages() now handles:
- writing pages which do not have full backing store allocated.
 1.11.4.3  12-Jul-1999  chs fix the PGO_OVERWRITE case, I don't know how it was working before.
tidy a few other bits.
 1.11.4.2  11-Jul-1999  chs yet another major rework of the generic getpages.
we now do the block allocations for allocating getpages operations
after reading the pages. for nested i/os, use b_resid rather than
b_bcount to track the amount left to go. return values for
getpages/putpages are now unix errnos rather than VM_PAGER_*.
readahead is gone again for the moment.
 1.11.4.1  04-Jul-1999  chs create genfs_getpages() and genfs_putpages().
these should be able to handle most of the local-disk filesystems.
 1.13.6.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.13.4.2  15-Nov-1999  fvdl Sync with -current
 1.13.4.1  19-Oct-1999  fvdl Bring in Kirk McKusick's FFS softdep code on a branch.
 1.13.2.6  12-Mar-2001  bouyer Sync with HEAD.
 1.13.2.5  11-Feb-2001  bouyer Sync with HEAD.
 1.13.2.4  05-Jan-2001  bouyer Sync with HEAD
 1.13.2.3  13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.13.2.2  08-Dec-2000  bouyer Sync with HEAD.
 1.13.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.17.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.18.2.1  14-Dec-2000  he Pull up revision 1.20 (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.31.2.22  07-Jan-2003  thorpej In the SA universe, the switch-to-this-LWP decision is made at a
different level than where preempt() calls are made, which renders
the "newlwp" argument useless. Replace it with a "more work to do"
boolean argument. Returning to userspace preempt() calls pass 0.
"Voluntary" preemptions in e.g. uiomove() pass 1. This will be used
to indicate to the SA subsystem that the LWP is not yet finished in
the kernel.

Collapse the SA vs. non-SA cases of preempt() together, making the
conditional code block much smaller, and don't call sa_preempt() if
more work is to come.

NOTE: THIS IS NOT A COMPLETE FIX TO THE preempt()-in-uiomove() PROBLEM
THAT CURRENTLY EXISTS FOR SA PROCESSES.
 1.31.2.21  11-Dec-2002  thorpej Sync with HEAD.
 1.31.2.20  11-Nov-2002  nathanw Catch up to -current
 1.31.2.19  23-Oct-2002  thorpej Fix a merge botch.
 1.31.2.18  23-Oct-2002  thorpej Sync with rev. 1.65.
 1.31.2.17  16-Jul-2002  nathanw pagedaemon_proc really should be a proc, not a LWP.
 1.31.2.16  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.31.2.15  24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.31.2.14  20-Jun-2002  nathanw Catch up to -current.
 1.31.2.13  17-Apr-2002  nathanw Catch up to -current.
 1.31.2.12  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.31.2.11  28-Feb-2002  nathanw LWPify.
 1.31.2.10  28-Feb-2002  nathanw Catch up to -current.
 1.31.2.9  09-Jan-2002  nathanw curproc ==> curproc->l_proc
 1.31.2.8  08-Jan-2002  nathanw Catch up to -current.
 1.31.2.7  14-Nov-2001  nathanw Catch up to -current.
 1.31.2.6  08-Oct-2001  nathanw Catch up to -current.
 1.31.2.5  21-Sep-2001  nathanw Catch up to -current.
 1.31.2.4  24-Aug-2001  nathanw Catch up with -current.
 1.31.2.3  21-Jun-2001  nathanw Catch up to -current.
 1.31.2.2  09-Apr-2001  nathanw Catch up with -current.
 1.31.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.35.2.8  02-Oct-2002  jdolecek knote data is now 64bit, g/c obsolete comment
 1.35.2.7  29-Sep-2002  jdolecek don't need cast to (caddr_t) for kn_hook anymore
 1.35.2.6  25-Sep-2002  jdolecek implement genfs_kqfilter() - this is based upon ufs_kqfilter(), but uses
vp->v_size for EVFILT_READ
 1.35.2.5  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.35.2.4  16-Mar-2002  jdolecek Catch up with -current.
 1.35.2.3  11-Feb-2002  jdolecek Sync w/ -current.
 1.35.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.35.2.1  25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.36.2.5  11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.36.2.4  01-Oct-2001  fvdl Catch up with -current.
 1.36.2.3  27-Sep-2001  fvdl Put back line that got misplaced somehow.
 1.36.2.2  26-Sep-2001  fvdl * add a VCLONED vnode flag that indicates a vnode representing a cloned
device.
* rename REVOKEALL to REVOKEALIAS, and add a REVOKECLONE flag, to pass
to VOP_REVOKE
* the revoke system call will revoke all aliases, as before, but not the
clones
* vdevgone is called when detaching a device, so make it use REVOKECLONE
to get rid of all clones as well
* clean up all uses of VOP_OPEN wrt. locking.
* add a few VOPS to spec_vnops that need to do something when it's a
clone vnode (access and getattr)
* add a copy of the vnode vattr structure of the original 'master' vnode
to the specinfo of a cloned vnode. could possibly redirect getattr to
the 'master' vnode, but this has issues with revoke
* add a vdev_reassignvp function that disassociates a vnode from its
original device, and reassociates it with the specified dev_t. to be
used by cloning devices only, in case a new minor is allocated.
* change all direct references in drivers to v_devcookie and v_rdev
to vdev_privdata(vp) and vdev_rdev(vp). for diagnostic purposes
when debugging race conditions that still exist wrt. locking and
revoking vnodes.
* make the locking state of a vnode consistent when passed to
d_open and d_close (unlocked). locked would be better, but has
some deadlock issues
 1.36.2.1  07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.39.2.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.62.2.1  30-May-2002  gehenna Catch up with -current.
 1.63.2.3  26-Aug-2003  tron Pull up revision 1.76 (requested by tls in ticket #1434):
Correct use of MAXBSIZE where MAXPHYS was intended. This is a necessary
first step towards per-device MAXPHYS, and has the beneficial side effect
of allowing clustering to MAXPHYS even on systems that need to run with
a reduced MAXBSIZE to get more metadata buffers.
 1.63.2.2  23-Oct-2002  lukem Pull up revision 1.65 (requested by fvdl in ticket #935):
Use B_ASYNC in the !PGO_SYNCIO case. Gets back most, if not all, NFS
read throughput performance lost since the introduction of UBC. Spotted
by YAMAMOTO Takashi, many thanks to him.
 1.63.2.1  01-Jun-2002  tv Pull up revision 1.64 (requested by enami in ticket #114):
Add missing pageq lock while uvm_pagefree() is called (either directly
or indirectly). Reviewed by chuq.
 1.80.2.11  11-Dec-2005  christos Sync with head.
 1.80.2.10  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.80.2.9  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.80.2.8  17-Feb-2005  skrll Sync with HEAD.
 1.80.2.7  04-Feb-2005  skrll Sync with HEAD.
 1.80.2.6  17-Jan-2005  skrll Sync with HEAD.
 1.80.2.5  19-Oct-2004  skrll Sync with HEAD
 1.80.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.80.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.80.2.2  03-Aug-2004  skrll Sync with HEAD
 1.80.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.92.2.1  29-Apr-2005  kent sync with -current
 1.93.2.3  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.93.2.2  12-Feb-2005  yamt sync with head.
 1.93.2.1  25-Jan-2005  yamt file genfs_vnops.c was added on branch yamt-km on 2005-02-12 18:17:53 +0000
 1.96.2.1  24-Aug-2005  riz Pull up following revision(s) (requested by yamt in ticket #688):
sys/miscfs/genfs/genfs_vnops.c: revision 1.98 via patch
sys/ufs/ffs/ffs_vfsops.c: revision 1.165
sys/ufs/lfs/lfs_extern.h: revision 1.69
sys/fs/filecorefs/filecore_vfsops.c: revision 1.20
sys/nfs/nfs_node.c: revision 1.80
sys/fs/smbfs/smbfs_node.c: revision 1.24
sys/fs/cd9660/cd9660_vfsops.c: revision 1.24
sys/fs/msdosfs/msdosfs_denode.c: revision 1.8
sys/miscfs/genfs/genfs_node.h: revision 1.6
sys/ufs/lfs/lfs_vfsops.c: revision 1.183
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.86
sys/fs/adosfs/advfsops.c: revision 1.23
sys/fs/ntfs/ntfs_vfsops.c: revision 1.31
- constify genfs_ops.
- use member designators.

sys/miscfs/genfs/genfs_vnops.c: revision 1.99 via patch
genfs_getpages: don't forget to put the vnode onto the syncer's work que
ue
even in the case of PGO_LOCKED.

sys/uvm/uvm_bio.c: revision 1.40
sys/uvm/uvm_pager.h: revision 1.29
sys/miscfs/genfs/genfs_vnops.c: revision 1.100 via patch
sys/ufs/ufs/ufs_inode.c: revision 1.50
- introduce PGO_NOBLOCKALLOC and use it for ubc mapping
to prevent unnecessary block allocations in the case that
page size > block size.
- ufs_balloc_range: use VM_PROT_WRITE+PGO_NOBLOCKALLOC rather than
VM_PROT_READ.

sys/uvm/uvm_fault.c: revision 1.96
sys/miscfs/genfs/genfs_vnops.c: revision 1.101 via patch
sys/uvm/uvm_object.h: revision 1.19
sys/miscfs/genfs/genfs_node.h: revision 1.7
ensure that vnodes with dirty pages are always on syncer's queue.
- genfs_putpages: wait for i/o completion of PG_RELEASED/PG_PAGEOUT pages by
setting "wasclean" false when encountering them.
suggested by Stephan Uphoff in PR/24596 (1).
- genfs_putpages: write protect pages when cleaning out, if
we're going to take the vnode off the syncer's queue.
uvm_fault: don't write-map pages unless its vnode is already on
the syncer's queue.
fix PR/24596 (3) but in the different way from the suggested fix.
(to keep our current behaviour, ie. not to require explicit msync.
discussed on tech-kern@.)
- genfs_putpages: don't mistakenly take a vnode off the queue
by introducing a generation number in genfs_node.
genfs_getpages: increment the generation number.
suggested by Stephan Uphoff in PR/24596 (2).
- add some assertions.

sys/miscfs/genfs/genfs_vnops.c: revision 1.102 via patch
genfs_putpages: don't bother to clean the vnode unless VONWORKLST.

sys/ufs/ffs/ffs_vnops.c: revision 1.71
ffs_full_fsync: because VBLK/VCHR can be mmap'ed,
do VOP_PUTPAGES for them as well.

sys/uvm/uvm_fault.c: revision 1.97
uvm_fault: check a correct object in the case of layered filesystems.
fix PR/30811 from Jukka Salmi.

sys/uvm/uvm_object.h: revision 1.20
sys/ufs/ffs/ffs_vfsops.c: revision 1.167
sys/uvm/uvm_bio.c: revision 1.41
sys/ufs/ufs/ufs_vnops.c: revision 1.129
sys/uvm/uvm_mmap.c: revision 1.92
sys/uvm/uvm_fault.c: revision 1.98
sys/kern/vfs_subr.c: revision 1.252
sys/fs/msdosfs/denode.h: revision 1.5
sys/miscfs/genfs/genfs_vnops.c: revision 1.103 via patch
sys/fs/msdosfs/msdosfs_denode.c: revision 1.9
sys/sys/vnode.h: revision 1.141
sys/ufs/ufs/ufs_inode.c: revision 1.51
sys/ufs/ufs/ufs_extern.h: revision 1.45 via patch
sys/miscfs/genfs/genfs_node.h: revision 1.8
sys/ufs/lfs/lfs_vfsops.c: revision 1.184
sys/uvm/uvm_pager.h: revision 1.30
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.87
update file timestamps for nfsd loaned-read and mmap.
PR/25279. discussed on tech-kern@.

sys/miscfs/genfs/genfs_vnops.c: revision 1.104 via patch
don't write-protect wired pages. pointed by Chuck Silvers.
for now, leave a vnode on the syncer's queue, as suggested by him.

sys/ufs/ffs/ffs_vnops.c: revision 1.72
revert VCHR part of ffs_vnops.c 1.71.
as VCHR uses the device pager, no point to call VOP_PUTPAGES here.
pointed by Chuck Silvers.
 1.98.2.10  24-Mar-2008  yamt sync with head.
 1.98.2.9  11-Feb-2008  yamt sync with head.
 1.98.2.8  04-Feb-2008  yamt sync with head.
 1.98.2.7  21-Jan-2008  yamt sync with head
 1.98.2.6  07-Dec-2007  yamt sync with head
 1.98.2.5  27-Oct-2007  yamt sync with head.
 1.98.2.4  03-Sep-2007  yamt sync with head.
 1.98.2.3  26-Feb-2007  yamt sync with head.
 1.98.2.2  30-Dec-2006  yamt sync with head.
 1.98.2.1  21-Jun-2006  yamt sync with head.
 1.107.2.1  20-Oct-2005  yamt remove genfs_fsync.
 1.109.2.4  19-Nov-2005  yamt remove contextless read-ahead code.
 1.109.2.3  18-Nov-2005  yamt - associate read-ahead context to vnode, rather than file.
- revert VOP_READ prototype.
 1.109.2.2  15-Nov-2005  yamt adapt ffs, lfs, nfs.
 1.109.2.1  14-Nov-2005  yamt disable genfs readahead.
 1.118.2.3  01-Feb-2006  yamt sync with head.
 1.118.2.2  15-Jan-2006  yamt sync with head.
 1.118.2.1  31-Dec-2005  yamt adapt some random parts of kernel to uio_vmspace.
 1.121.4.2  01-Jun-2006  kardel Sync with head.
 1.121.4.1  22-Apr-2006  simonb Sync with head.
 1.121.2.1  09-Sep-2006  rpaulo sync with head
 1.122.6.2  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.122.6.1  31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.122.4.3  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.122.4.2  19-Apr-2006  elad sync with head.
 1.122.4.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.122.2.5  11-Aug-2006  yamt sync with head
 1.122.2.4  24-May-2006  yamt sync with head.
 1.122.2.3  11-Apr-2006  yamt sync with head
 1.122.2.2  01-Apr-2006  yamt sync with head.
 1.122.2.1  05-Mar-2006  yamt separate page replacement policy from the rest of kernel.
 1.128.4.4  01-Feb-2007  ad Sync with head.
 1.128.4.3  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.128.4.2  12-Jan-2007  ad Sync with head.
 1.128.4.1  18-Nov-2006  ad Sync with head.
 1.129.2.3  18-Dec-2006  yamt sync with head.
 1.129.2.2  10-Dec-2006  yamt sync with head.
 1.129.2.1  22-Oct-2006  yamt sync with head
 1.140.4.1  03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.140.2.1  05-Jun-2007  bouyer Pull up following revision(s) (requested by perseant in ticket #703):
sys/miscfs/genfs/genfs.h 1.21
sys/miscfs/genfs/genfs_vnops.c 1.151
sys/ufs/lfs/lfs.h 1.119, 1.120
sys/ufs/lfs/lfs_bio.c 1.99-101
sys/ufs/lfs/lfs_extern.h 1.89
sys/ufs/lfs/lfs_inode.c 1.108, 1.109
sys/ufs/lfs/lfs_segment.c 1.197, 1.199, 1.200
sys/ufs/lfs/lfs_subr.c 1.69, 1.70
sys/ufs/lfs/lfs_syscalls.c 1.119
sys/ufs/lfs/lfs_vfsops.c 1.234, 1.235
sys/ufs/lfs/lfs_vnops.c 1.195, 1.196, 1.200, 1.202-206

Reduce busy waiting in lfs_putpages(), and other LFS improvements.
 1.146.2.4  17-May-2007  yamt sync with head.
 1.146.2.3  07-May-2007  yamt sync with head.
 1.146.2.2  12-Mar-2007  rmind Sync with HEAD.
 1.146.2.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.150.4.1  11-Jul-2007  mjf Sync with head.
 1.150.2.15  23-Oct-2007  ad Sync with head.
 1.150.2.14  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.150.2.13  01-Sep-2007  yamt fix a race and add a comment about it.
 1.150.2.12  24-Aug-2007  ad Sync with buffer cache locking changes. See buf.h/vfs_bio.c for details.
Some minor portions are incomplete and needs to be verified as a whole.
 1.150.2.11  21-Aug-2007  yamt fix some races around pagedaemon and uvm_wait. ok'ed by Andrew Doran.
 1.150.2.10  19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.150.2.9  23-Jun-2007  ad - Lock v_cleanblkhd, v_dirtyblkhd, v_numoutput with the vnode's interlock.
Get rid of global_v_numoutput_lock. Partially incomplete as the buffer
cache locking doesn't work very well and needs an overhaul.
- Some changes to try and make softdep MP safe. Untested.
 1.150.2.8  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.150.2.7  09-Jun-2007  ad Sync with head.
 1.150.2.6  08-Jun-2007  ad Sync with head.
 1.150.2.5  13-Apr-2007  ad - Fix a (new) bug where vget tries to acquire freed vnodes' interlocks.
- Minor locking fixes.
 1.150.2.4  09-Apr-2007  ad - Add two new arguments to kthread_create1: pri_t pri, bool mpsafe.
- Fork kthreads off proc0 as new LWPs, not new processes.
 1.150.2.3  05-Apr-2007  ad Compile fixes.
 1.150.2.2  21-Mar-2007  ad - Replace more simple_locks, and fix up in a few places.
- Use condition variables.
- LOCK_ASSERT -> KASSERT.
 1.150.2.1  13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.155.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.156.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.156.10.1  29-Jul-2007  ad file genfs_vnops.c was added on branch matt-mips64 on 2007-07-29 12:15:47 +0000
 1.156.8.2  18-Oct-2007  yamt sync with head.
 1.156.8.1  14-Oct-2007  yamt sync with head.
 1.156.6.3  23-Mar-2008  matt sync with HEAD
 1.156.6.2  09-Jan-2008  matt sync with HEAD
 1.156.6.1  06-Nov-2007  matt sync with HEAD
 1.156.4.2  09-Dec-2007  jmcneill Sync with HEAD.
 1.156.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.158.6.2  08-Dec-2007  ad Sync with head.
 1.158.6.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.158.4.2  18-Feb-2008  mjf Sync with HEAD.
 1.158.4.1  08-Dec-2007  mjf Sync with HEAD.
 1.159.4.2  19-Jan-2008  bouyer Sync with HEAD
 1.159.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.164.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.164.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.165.2.1  18-May-2008  yamt sync with head.
 1.166.2.7  09-Oct-2010  yamt sync with head
 1.166.2.6  11-Aug-2010  yamt sync with head.
 1.166.2.5  11-Mar-2010  yamt sync with head
 1.166.2.4  18-Jul-2009  yamt sync with head.
 1.166.2.3  16-May-2009  yamt sync with head
 1.166.2.2  04-May-2009  yamt sync with head.
 1.166.2.1  16-May-2008  yamt sync with head.
 1.167.18.1  20-May-2011  matt bring matt-nb5-mips64 up to date with netbsd-5-1-RELEASE (except compat).
 1.167.16.1  07-Sep-2010  bouyer Pull up following revision(s) (requested by chs in ticket #1448):
sys/uvm/uvm_pager.h: revision 1.39 via patch
sys/miscfs/genfs/genfs_vnops.c: revision 1.183 via patch
sys/ufs/ufs/ufs_inode.c: revision 1.83 via patch
sys/miscfs/genfs/genfs_io.c: revision 1.40 via patch
sys/miscfs/genfs/genfs_node.h: revision 1.20 via patch
replace the earlier workaround for PR 40389 with a better fix.
the earlier change caused data corruption by freeing pages
without invaliding their mappings. instead of the trylock/retry,
just take the genfs-node lock before calling VOP_GETPAGES()
and pass a new flag to tell it that we're already holding this lock.
 1.167.14.2  23-Jul-2009  jym Sync with HEAD.
 1.167.14.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.167.10.1  07-Sep-2010  bouyer Pull up following revision(s) (requested by chs in ticket #1448):
sys/uvm/uvm_pager.h: revision 1.39 via patch
sys/miscfs/genfs/genfs_vnops.c: revision 1.183 via patch
sys/ufs/ufs/ufs_inode.c: revision 1.83 via patch
sys/miscfs/genfs/genfs_io.c: revision 1.40 via patch
sys/miscfs/genfs/genfs_node.h: revision 1.20 via patch
replace the earlier workaround for PR 40389 with a better fix.
the earlier change caused data corruption by freeing pages
without invaliding their mappings. instead of the trylock/retry,
just take the genfs-node lock before calling VOP_GETPAGES()
and pass a new flag to tell it that we're already holding this lock.
 1.167.8.1  28-Apr-2009  skrll Sync with HEAD.
 1.176.4.4  05-Mar-2011  rmind sync with head
 1.176.4.3  03-Jul-2010  rmind sync with head
 1.176.4.2  30-May-2010  rmind sync with head
 1.176.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.176.2.3  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.176.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.176.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.186.6.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.187.6.1  05-Apr-2012  mrg sync to latest -current.
 1.187.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.187.2.1  17-Apr-2012  yamt sync with head
 1.189.4.1  18-May-2014  rmind sync with head
 1.189.2.2  03-Dec-2017  jdolecek update from HEAD
 1.189.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.192.14.1  08-Jul-2017  snj Pull up following revision(s) (requested by christos in ticket #1442):
sys/kern/kern_event.c: revision 1.92 via patch
sys/miscfs/genfs/genfs_vnops.c: revision 1.198 via patch
sys/sys/event.h: revision 1.30 via patch
Provide EVFILT_WRITE; this is what FreeBSD does and go wants it.
Makes go unit tests pass.
--
fix file descriptor locking (from joerg).
fixes kernel crashes by running go
 1.192.10.2  26-Apr-2017  pgoyette Sync with HEAD
 1.192.10.1  20-Mar-2017  pgoyette Sync with HEAD
 1.192.8.1  08-Jul-2017  snj Pull up following revision(s) (requested by christos in ticket #1442):
sys/kern/kern_event.c: revision 1.92 via patch
sys/miscfs/genfs/genfs_vnops.c: revision 1.198 via patch
sys/sys/event.h: revision 1.30 via patch
Provide EVFILT_WRITE; this is what FreeBSD does and go wants it.
Makes go unit tests pass.
--
fix file descriptor locking (from joerg).
fixes kernel crashes by running go
 1.192.6.2  28-Aug-2017  skrll Sync with HEAD
 1.192.6.1  05-Feb-2017  skrll Sync with HEAD
 1.192.4.1  08-Jul-2017  snj Pull up following revision(s) (requested by christos in ticket #1442):
sys/kern/kern_event.c: revision 1.92 via patch
sys/miscfs/genfs/genfs_vnops.c: revision 1.198 via patch
sys/sys/event.h: revision 1.30 via patch
Provide EVFILT_WRITE; this is what FreeBSD does and go wants it.
Makes go unit tests pass.
--
fix file descriptor locking (from joerg).
fixes kernel crashes by running go
 1.193.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.195.4.2  05-Jul-2017  snj Pull up following revision(s) (requested by christos in ticket #91):
sys/kern/kern_event.c: revision 1.92
sys/miscfs/genfs/genfs_vnops.c: revision 1.198
sys/sys/event.h: revision 1.30
Provide EVFILT_WRITE; this is what FreeBSD does and go wants it.
Makes go unit tests pass.
--
fix file descriptor locking (from joerg).
fixes kernel crashes by running go
 1.195.4.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.199.4.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.200.2.4  29-Feb-2020  ad Sync with head.
 1.200.2.3  24-Jan-2020  ad vnodes:

- Have own v_usecount again, don't share the uvm_object's refcount.
- Cluster the members of vnode_t and vnode_impl_t in a cache-concious way.
- Go back to having vi_lock directly in vnode_impl_t.
- Go back to having v_usecount adjusted with atomics.
- Start adjusting v_holdcnt with atomics, too.
- Put all the namecache stuff back into vnode_impl_t.
 1.200.2.2  22-Jan-2020  ad Make sure LK_UPGRADE always comes with LK_NOWAIT; dropping the lock in here
is unclean and I wonder if it could screw over fstrans.
 1.200.2.1  18-Jan-2020  ad Allow VOP_LOCK(LK_NONE).
 1.210.6.1  01-Aug-2021  thorpej Sync with HEAD.
 1.219.4.1  05-Mar-2023  martin Pull up following revision(s) (requested by hannken in ticket #111):

sys/miscfs/genfs/genfs_vnops.c: revision 1.220

Fix genfs_can_chtimes() to also handle the condition:

If the time pointer is null, then write permission
on the file is also sufficient.

From FreeBSD.

Should fix PR kern/57246 "NFS group permissions regression"

RSS XML Feed