Home | History | Annotate | Download | only in nfs
History log of /src/sys/nfs/nfs_serv.c
RevisionDateAuthorComments
 1.184  23-Mar-2023  riastradh nfs: Avoid free of uninitialized on bad name size in create, mknod.

XXX These error branches are a nightmare and need to be more
systematically cleaned up. Even if they are correct now, they are
impossible to audit and extremely fragile in case anyone ever needs
to make other changes to them.

XXX pullup-8
XXX pullup-9
XXX pullup-10
 1.183  27-Apr-2022  hannken branches: 1.183.4;
As VOP_GETATTR() needs a shared lock at least move the preopattr lookup
inside nfs_namei() where we may lock the start directory without violating
the lock order.
 1.182  16-Sep-2021  andvar fix various typos, mainly in comments.
 1.181  05-Sep-2020  riastradh 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.180  04-Apr-2020  mlelstv NFSv2 is limited to use only 32bit in metadata. Prevent that larger
metadata values are simply truncated.

-> clamp filesystem block counts to signed 32bit.
-> clamp file sizes to signed 32bit (*)

Some NFSv2 clients also have problems to handle buffer sizes larger
than (signed) 16bit.
-> clamp buffer sizes to signed 16bit for better compatibility.

(*) This can lead to erroneous behaviour for files larger than 2GB
that NFSv2 cannot handle but it is still better than before.
An alternative would be to (partially) reject operations on files
larger than 2GB, but which causes other problems.
 1.179  17-Jan-2020  ad VFS_VGET(), VFS_ROOT(), VFS_FHTOVP(): give them a "int lktype" argument, to
allow us to get shared locks (or no lock) on the returned vnode. Matches
FreeBSD.
 1.178  02-Jan-2020  thorpej branches: 1.178.2;
- Eliminate the global "boottime" variable, which was being accessed
without any synchronization against changes by e.g. clock_settime().
- Replace with new getbinboottime() / getnanoboottime() / getmicroboottime()
functions (naming mirrors that of other time access functions in kern_tc.c).
It returns the (maybe-converted) value of timebasebin, which also tracks
our estimate of when the system was booted (i.e. the legacy "boottime" was
redundant).

XXX There needs to be a lockless synchronization mechanism for reading
timebasebin, but this is a problem in kern_tc.c that pre-existed these
"boottime" changes. At least now the problem is centralized in one location.
 1.177  20-Feb-2019  hannken branches: 1.177.4;
Bracket do_sys_renameat() and nfsrv_rename() with fstrans.

The v_mount field for vnodes on the same file system as "from"
is now stable for referenced vnodes.

VFS_RENAMELOCK no longer may use lock from an unreferenced and
freed "struct mount".
 1.176  03-Feb-2019  mrg - add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily
 1.175  03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.174  03-May-2018  hannken branches: 1.174.2;
nfsrv_readlink: stop attaching a zero-length mbuf for zero length symlinks.
 1.173  26-Apr-2017  riastradh branches: 1.173.4; 1.173.10;
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.172  21-Apr-2015  riastradh Cull unused INRENAME and INRELOOKUP from callers.
 1.171  20-Apr-2015  riastradh Make VOP_LINK return directory still locked and referenced.

Ride 7.99.10 bump.
 1.170  23-Jan-2014  hannken branches: 1.170.6;
Change vnode operations create, mknod, mkdir and symlink to return
the resulting vnode *vpp unlocked.

Discussed on tech-kern@

Welcome to 6.99.30
 1.169  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.168  14-Dec-2013  christos only prevent autounload, not regular unload when we have exports
 1.167  14-Dec-2013  christos don't allow the nfs server module to unload if it has exported filesystems.
 1.166  14-Sep-2013  martin Backout wildcard pragma to kill warnings and instead sprinkle a few dozen
__unused attributes.
Requested by joerg@
 1.165  29-Aug-2012  christos branches: 1.165.2; 1.165.4;
When unloading the nfsserver module, call nfs_fini() so that the nfsrvdescpl
pool gets destroyed. Otherwise we are left with a stray pool that points to
unmapped memory behind (and bad things happen). Typically you get seemingly
random page faults (without printing uvm_fault) that happen in various pool
operations. Most frequent one is the pool_drain() from the page daemon.
 1.164  27-Aug-2012  chs fix error handling in nfsrv_rename(): when the first nfs_namei() fails,
don't try to free the resources allocated by a successful lookup.
 1.163  01-Feb-2012  matt branches: 1.163.2; 1.163.4;
When using socket loaning, make sure the KVA used for the loan has the same
color as the UVA being loaned.
 1.162  21-Nov-2011  hannken branches: 1.162.2;
nfsrv_lookup(): Defer the postopattr lookup on dirp until the
child node is unlocked.

Ok: YAMAMOTO Takashi <yamt@netbsd.org>
 1.161  30-Oct-2011  hannken branches: 1.161.2;
VOP_GETATTR() needs a shared lock at least.
 1.160  08-Aug-2011  dholland nfs_namei() should not return a non-null path buffer except on success,
even though the callers are apparently prepared to cope.

Fixes last tidyup part of PR 44625.
 1.159  18-Apr-2011  dholland Back in -r1.60 of nfs_serv.c (a long time ago) VOP_MKNOD was changed
so nfsd no longer needed to do a lookup() call immediately afterwards
to retrieve the newly created object.

Since that change there has been no way for ISSYMLINK to be set upon
return from VOP_MKNOD (or before the call to VOP_MKNOD either) so
remove the test for it and associated block of dead code.

(I do not understand how this code was reachable before then either.
The logic in question is only reached if no object by that name
existed, and there's no reasonable way that a successful call to
VOP_MKNOD should ever create a symlink. The code appears to come from
4.4lite; maybe they had locking bugs?)
 1.158  11-Apr-2011  dholland Clean up. Move some more code across from nfsd's private entry points.
 1.157  19-Mar-2011  dholland Fix memory leak introduced with the struct pathbuf changes. Hi, me.
Closes PR 44625.
 1.156  05-Feb-2011  yamt typo in a comment
 1.155  02-Jan-2011  dholland branches: 1.155.2; 1.155.4;
Remove remaining references to SAVESTART.
 1.154  02-Jan-2011  dholland Remove the special refcount behavior (adding an extra reference to the
parent dir) associated with SAVESTART in relookup().

Check all call sites to make sure that SAVESTART wasn't set while
calling relookup(); if it was, adjust the refcount behavior. Remove
related references to SAVESTART.

The only code that was reaching the extra ref was msdosfs_rename,
where the refcount behavior was already fairly broken and/or gross;
repair it.

Add a dummy 4th argument to relookup to make sure code that hasn't
been inspected won't compile. (This will go away next time the
relookup semantics change, which they will.)
 1.153  02-Jan-2011  dholland Remove unused nameidata field ni_startdir.
 1.152  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.151  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.150  08-Jan-2010  pooka branches: 1.150.2; 1.150.4;
The VATTR_NULL/VREF/VHOLD/HOLDRELE() macros lost their will to live
years ago when the kernel was modified to not alter ABI based on
DIAGNOSTIC, and now just call the respective function interfaces
(in lowercase). Plenty of mix'n match upper/lowercase has creeped
into the tree since then. Nuke the macros and convert all callsites
to lowercase.

no functional change
 1.149  23-Dec-2009  pooka Define namei flag INRENAME and set it if a lookup operation is part
of rename. This helps with building better asserts for rename in
the DELETE lookup ... the RENAME lookup is quite obviously a part
of rename.
 1.148  07-Nov-2009  cegger Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
 1.147  27-Sep-2009  dholland Rename lookup() to lookup_for_nfsd(), to make it clear just whose
private backdoor entry point this is.

Also, clone the lookup_for_nfsd() entry point as
lookup_for_nfsd_index(), for use by a different call site in nfsd that
does different unclean things with nameidata.
 1.146  23-May-2009  ad - Fix a race between umount()/mount() and nfssvc().
- Toss netexport state on nfsserver module unload.
 1.145  23-May-2009  ad Fix a crash when unloading nfsserver module.
 1.144  10-Apr-2009  bouyer PR kern/41158: nfs_rename() locking against myself
nfsrv_rename() can exit without calling genfs_renamelock_exit() because
the nfsm_reply() can do return (0) on error.
Change nfsm_reply to use 'error = 0; goto nfsmout' instead.
Fix a few place so it's safe to goto nfsmout from nfsm_reply, or other
macros calling it.
As a side effect it could fix a missing vrele(dirp) in various place where
nfsm_reply could return(0).
 1.143  14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.142  11-Jan-2009  christos branches: 1.142.2;
merge christos-time_t
 1.141  03-Dec-2008  pooka nfsd_use_loan: int -> bool
 1.140  27-Nov-2008  pooka Use struct nfs_fattr in struct flrep instead of uint32_t array
acrobatics to get rid of type punning warning.
 1.139  19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.138  28-Mar-2008  dholland branches: 1.138.2; 1.138.6; 1.138.12; 1.138.14; 1.138.16;
Yet another rename workaround - this time check for . and .. early because
relookup() objects to being asked to handle them.
 1.137  08-Mar-2008  yamt desupport link/unlink of directories. noted by Elad Efrat.
 1.136  28-Feb-2008  elad Introduce a new kauth action, KAUTH_NETWORK_NFS, and two requests,
KAUTH_REQ_NETWORK_NFS_EXPORT and KAUTH_REQ_NETWORK_NFS_SVC, and use them
to replace two KAUTH_GENERIC_ISSUSER calls in the NFS code.

Also replace two more with KAUTH_SYSTEM_MKNOD, where appropriate.

Documetnation and examples updated. More to come.
 1.135  20-Feb-2008  matt branches: 1.135.2; 1.135.6;
Fix extern declaration to match actual declaration (add const).
 1.134  28-Jan-2008  dholland Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it.
Get this lock while renaming. Also add another relookup() in do_sys_rename,
which is a hack to kludge around some of the worst deficiencies of
ufs_rename.
reviewed-by: pooka (and an earlier rev by ad)
posted on tech-kern with no objections.
 1.133  22-Dec-2007  yamt nfsrv_create: fix a use-after-release.
 1.132  04-Dec-2007  yamt branches: 1.132.4;
merge non-intrusive nfs changes from vmlocking.
 1.131  26-Nov-2007  pooka branches: 1.131.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.130  10-Oct-2007  ad branches: 1.130.4;
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.129  27-Jul-2007  yamt branches: 1.129.4; 1.129.6; 1.129.8; 1.129.10;
stop nfs tick when we have nothing to do.
 1.128  06-Apr-2007  hannken branches: 1.128.4;
Remove calls to now obsolete vn_start_write() and vn_finished_write().
 1.127  05-Mar-2007  yamt branches: 1.127.2; 1.127.4;
nfsrv_setattr: revive nfsm_srvsattr which was (mistakenly?)
removed with caddr_t.
 1.126  04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.125  22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.124  20-Feb-2007  pooka after freeing cookies, set the pointer to NULL to prevent dangling reuse
 1.123  04-Feb-2007  chs branches: 1.123.2;
in nfsrv_rename(), change vput(fdirp) back to vrele() since the dirp
returned from nfs_namei() is not locked in this case. fixes PR 35542.
also, apply the same fix here as was made in rename_files() to handle
the case when dvp and vp are the same.
 1.122  04-Jan-2007  elad Consistent usage of KAUTH_GENERIC_ISSUSER.
 1.121  27-Dec-2006  yamt remove nqnfs.
 1.120  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.119  09-Nov-2006  yamt branches: 1.119.2;
remove some __unused in function parameters.
 1.118  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.117  02-Sep-2006  yamt branches: 1.117.2; 1.117.4;
nfsd: deal with variable-sized filehandles.
 1.116  02-Sep-2006  christos fix default type decls
fix incomplete initializer
 1.115  20-Jul-2006  christos When there are too many empty entries in a row, and we need to try to
read the next block, free the cookie buffer before doing so to avoid
a memory leak. Reported by Mark Davies.
 1.114  13-Jul-2006  martin Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.113  30-Jun-2006  yamt wrap long lines and fix indents after kauth merge.
 1.112  17-Jun-2006  yamt - introduce vfs_composefh() and use it where appropriate.
- fix lock/unlock mismatch in sys_getfh.
 1.111  09-Jun-2006  christos branches: 1.111.2;
stack police: don't allocate statvfs on the stack.
 1.110  07-Jun-2006  kardel merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.109  14-May-2006  elad branches: 1.109.2;
integrate kauth.
 1.108  10-May-2006  mrg quell GCC 4.1 uninitialised variable warnings.

XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
 1.107  15-Apr-2006  christos Coverity CID 735: Remove duplicate code.
 1.106  15-Apr-2006  christos Coverity CID 736: Comment out dead code.
 1.105  15-Apr-2006  christos Coverity CID 1143: Prevent NULL deref.
 1.104  15-Apr-2006  christos Coverity CID 1144: Protect against NULL deref.
 1.103  15-Apr-2006  christos Coverity CID 2510-2514: Always initialize cache.
 1.102  27-Mar-2006  martin KASSERT that the returned file id length from VPTOFH is <= the
maximum allowed value (_VFS_MAXFIDSZ).
 1.101  01-Mar-2006  yamt branches: 1.101.2; 1.101.4; 1.101.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.100  03-Jan-2006  yamt branches: 1.100.2; 1.100.4;
remove a few unnecessary caddr_t casts.
 1.99  11-Dec-2005  christos branches: 1.99.2;
merge ktrace-lwp.
 1.98  06-Oct-2005  yamt branches: 1.98.6;
- remove a ufs dependency.
- bump readdir block size to 1024. (the same value as userland DIRBLKSIZ)
 1.97  06-Sep-2005  jmmv Set va_type to VLNK before calling VOP_SYMLINK to match the change in the
vfs_syscalls.c file. Pointed out by yamt@.
 1.96  19-Aug-2005  yamt as we now have 64bit ino_t, no need to truncate nfsv3 fileids.
 1.95  18-May-2005  yamt branches: 1.95.2;
nfsrv_mknod: reject device numbers which we can't handle.
 1.94  26-Feb-2005  perry nuke trailing whitespace
 1.93  09-Dec-2004  yamt branches: 1.93.2; 1.93.4;
nfsrv_commit: make cnt unsigned so that very large commit requests can be
handled properly.
 1.92  09-Dec-2004  yamt when calling create-type VOP, make sure that va_mode is set
even when a client doesn't specify it.
(most filesystems get confused if va_mode is VNOVAL.)
 1.91  04-Dec-2004  yamt nfsrv_read: fall back to copying when fail to loan pages.
(i forgot to commit this with uvm_loan.c rev.1.51.)
 1.90  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.89  31-May-2004  yamt nfsrv_create: fix an LP64 problem for exclusive create.
 1.88  21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.87  07-Jan-2004  yamt branches: 1.87.2;
- get pages to loan out in uvm_loanuobjpages() rather than
having caller (nfsd, in this case) do so.
- tweak locking so that nfs loaned READ works on layered filesystems.
 1.86  05-Nov-2003  hannken Clean up the usage of vn_start_write(). At least one occurence clobbered
previous error conditions.
If "(flags & (V_WAIT|V_PCATCH)) == V_WAIT" the return value is always zero.
Ignore the return value in these cases.

From Darrin B. Jewell.
 1.85  29-Oct-2003  mycroft Back out the bogus initializer -- the compiler bug is fixed.
 1.84  28-Oct-2003  cl note 'm68k {u,}int64_t used uninitialized' bug.
add reference to gcc bug report.
mark all (known) occurrences.
 1.83  20-Oct-2003  yamt set READres EOF flag correctly.
 1.82  15-Oct-2003  hannken Add the gating of system calls that cause modifications to the underlying
file system.
The function vfs_write_suspend stops all new write operations to a file
system, allows any file system modifying system calls already in progress
to complete, then sync's the file system to disk and returns. The
function vfs_write_resume allows the suspended write operations to
complete.

From FreeBSD with slight modifications.

Approved by: Frank van der Linden <fvdl@netbsd.org>
 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  09-Jul-2003  bouyer nfsrv_commit(): return success and don't do anything for requests which starts
past the end of the file. This can happen when two clients are writting to
the same file.
Close PR 21696 by myself, discussed on tech-net in 2003/05 and 2003/06.
Issue raised by Chuck Silvers (commit and truncate ops needs to be serialised)
still unadressed.
 1.79  29-Jun-2003  fvdl branches: 1.79.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.78  29-Jun-2003  thorpej Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.77  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.76  09-Jun-2003  yamt rework zero padding of rpc reply.
- for READ procedure, don't send back more bytes than requested.
- don't have doubtful assumptions on mbuf chain structure.
- rename a function (nfsm_adj -> nfs_zeropad) to avoid confusion as
the semantics of the function was changed.
 1.75  29-May-2003  yamt workaround for UBC limit.

while our nfsd announces MAXBSIZE as wtmax for tcp,
VOP_GETPAGES of filesystems that uses genfs_getpages can't
handle >= MAX_READ_AHEAD(16) pages at once.
therefore, depending on PAGE_SIZE of the machine and file offset of
a read request, we can't VOP_GETPAGES the range at once.
 1.74  07-May-2003  yamt - indent.
- fix a comment typo (mus -> must)
- remove an unneeded caddr_t cast.
 1.73  04-May-2003  yamt fix handling of the case that readsize == 0.
 1.72  03-May-2003  yamt use uvm page loanout mechanism for nfsd READ procedure processing.

reviewed by Frank van der Linden and Chuck Silvers.
tested by Wojciech Puchar.
 1.71  03-Apr-2003  yamt return rtmax bytes if we get READ requests larger than rtmax.
 1.70  02-Apr-2003  yamt use queue manipulation macros.
 1.69  28-Mar-2003  yamt reply FSINFO rtmax and wtmax for DGRAM properly.
 1.68  28-Mar-2003  yamt reply ENAMETOOLONG properly instead of discarding request as BADRPC.
my own PR20791.
 1.67  26-Feb-2003  matt Add MBUFTRACE kernel option.
Do a little mbuf rework while here. Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *). These are not performance critical and making them
call m_get saves considerable space. Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.
 1.66  01-Dec-2002  matt Make sure these all agree on the same definitons of various variables.
 1.65  27-Sep-2002  bouyer In nfs_commit(), sanity-check what we get from network: if we try to fluch
past end of file, or if off + cnt overflows a quad_t, flush to end of file.
 1.64  26-Sep-2002  bouyer In nfsrv_create(), kill an extra PNBUF_PUT() in the NFSv2 mknod case. The
pnbuf has already been freed by VOP_MKNOD. This should have been removed in
rev 1.60.
Should fix PR 18013, OK'd by fvdl.
 1.63  26-Sep-2002  bouyer nfsrv_commit(): Properly handle the case cnt == 0, which means "flush to
end of file". Calling VOP_FSYNC with start == end triggers a DIAGNOSTIC
check. Noticed with NFSv3 Linux clients. OK'd by fvdl.
 1.62  10-Nov-2001  lukem branches: 1.62.10;
add RCSIDs
 1.61  23-Sep-2001  chs branches: 1.61.2;
remove SAVESTART from the symlink, mknod and create operations.
it was unnecessary, and removing it also fixes a v_usecount leak
that was introduced in the previous revision.
 1.60  24-Jul-2001  assar branches: 1.60.2;
change vop_symlink and vop_mknod to return vpp (the created node)
refed, so that the caller can actually use it. update callers and
file systems that implement these vnode operations
 1.59  27-Nov-2000  chs branches: 1.59.2; 1.59.4;
Initial integration of the Unified Buffer Cache project.
 1.58  19-Sep-2000  fvdl Adapt for VOP_FSYNC parameter change.
 1.57  03-Aug-2000  thorpej Convert namei pathname buffer allocation to use the pool allocator.
 1.56  03-Aug-2000  thorpej MALLOC()/FREE() are not to be used for variable size allocations.
 1.55  27-Jun-2000  mrg remove include of <vm/vm.h>
 1.54  30-Mar-2000  augustss branches: 1.54.4;
Remove register declarations.
 1.53  30-Mar-2000  simonb Delete redundant decl of nfs_pub - it's in <sys/mount.h>.
 1.52  05-Dec-1999  fvdl The length check for readdirplus entries wasn't right, causing troubles
with 32k readdir sizes. From FreeBSD.
 1.51  04-May-1999  sommerfe branches: 1.51.2; 1.51.8;
Fix vnode lock leak in nfsrv_mknod() if to-be-created vnode already existed.
 1.50  30-Mar-1999  mycroft branches: 1.50.2;
Fix two problems with NFSV3CREATE_GUARDED:
* We shouldn't truncate the file.
* We were leaving the vnode locked (unless the truncate happened to fail).
Solaris clients may cause this under some conditions.
Problem reported by chopps, analysis and fix by me.
 1.49  24-Mar-1999  mrg completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.48  06-Mar-1999  fair Snatch a patch from OpenBSD to fix PRs 6529 and 7074.
Adjust fxdr_hyper() and txdr_hyper() macros.
 1.47  05-Mar-1999  mycroft Clean up some sign extension bogosity in statfs, so negative numbers are
actually negative on a LP64 client.
 1.46  31-Jan-1999  mrg non-root users can mkfifo over NFS.
 1.45  18-Aug-1998  thorpej Add some braces to make egcs happy (ambiguous else warning).
 1.44  09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.43  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.
 1.42  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.41  10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.40  05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the rest of the MI portion changes.

this will be KNF'd shortly. :-)
 1.39  22-Dec-1997  fvdl Check vnode for VDIR type before doing anything with it in the
NFS readdir service.
 1.38  10-Oct-1997  fvdl branches: 1.38.2;
* New directory entry caching system. Provides full caching of any
directory cookie that may be thrown back at us from userspace, up
to a size limit. Fixes double entry problem.
* Split flags for internal and external use in the NFS mount structure.
* Fix some buffer structure fields that weren're being used correctly.
* Fix missing directory cache inval call in nfs_open.
* Limit on NFS_DIRBLKSIZ no longer needed, bumped to the more reasonable
value of 8k.
* Various other things that I forget, all related to the dir caching
somehow, though.
 1.37  17-Jul-1997  fvdl branches: 1.37.2;
* Deal with servers that don't give complete FSINFO (like NT)
From Olaf Seibert <rhialto@polder.ubc.kun.nl> (PR 3687)
* Make an attempt to check the maximum filesize before attempting
a write to the server, as write RPCs will typically happen
asynchronously, and the process will not see the error.
Fixes problems with unexpectly truncated files at 4G
* Pass up errors in nfs_writerpc correctly
 1.36  15-Jul-1997  fvdl A filesystem may not support VFS_VGET (like msdosfs). If it doesn't,
the server code would always skip all dir entries for a readdirplus
operation. To avoid endlessly retrying clients, try VFS_VGET first,
and it it fails, return NFSERR_NOTSUPP so that client will fall
back to normal readdir operations.
 1.35  24-Jun-1997  fvdl Provide the extra arg to nfsrv_fhtovp, signalling if we're dealing with
a request on the public filehandle. Extend the lookup operation to
support WebNFS, including index file support (URL style). Yucky, it's
optional in the spec, but Solaris 2.6 will support it, so..
 1.34  12-May-1997  fvdl In nfsrvw_coalesce, make sure the coalesce list from the nfsd is moved
as well. This fixes client hangs. (from Naofumi Honda
<honda@Kururu.math.sci.hokudai.ac.jp> / NetBSD-pc98)
 1.33  08-May-1997  mycroft Pass the vnode type to vaccess(), and use it when checking VEXEC. Make sure
that the mode bits passed to vaccess() and returned by foo_getattr() contain
only permission bits.
 1.32  08-May-1997  mycroft VEXEC -> VLOOKUP, as appropriate.
 1.31  22-Feb-1997  fvdl Fixes from BSDI (thanks go to Keith Bostic). Original RCS message:

date: 1996/11/20 20:02:54; author: pjd; state: Exp; lines: +7 -4
In nfsrv_access(), if VOP_ACCESS() returns an error and the
error == EPERM or its not the owner doing the access, return the error.
 1.30  10-Feb-1997  fvdl Move vnode_pager_uncache to a better spot in nfsrv_remove. Also use it
in nfsrv_rename, if the 2nd argument is an existing file and will thus
be removed.
 1.29  31-Jan-1997  fvdl branches: 1.29.2;
nfsrv_readdirplus also suffered from the off-by-one loop problem; fix it too.
 1.28  31-Jan-1997  fvdl Fix order error in loop condition which could cause a crash in nfsrv_readdir().
Fixes PR #3170
 1.27  11-Dec-1996  fvdl Give permission to the owner of the file to preserve semantics only
in the relevant cases (read, write). Fixes PR 3017.
 1.26  01-Jul-1996  fvdl Always call vnode_pager_uncache when removing a file in the server
(same as in sys_unlink()).
 1.25  02-Mar-1996  jtk branches: 1.25.4;
Do not return whiteout directory entries in NFS readdir replies. (The
NFS protocol doesn't know how to deal with them properly, yet.)
 1.24  20-Feb-1996  cgd Third argument to VOP_PATHCONF is a register_t *, and register_t may be
different than 'int'. Do the right thing when declaring variables which
are used this way.
 1.23  18-Feb-1996  fvdl Bring in a merge of Rick Macklem's NFSv3 code from Lite2
 1.22  09-Feb-1996  christos nfs prototype changes
 1.21  09-Feb-1996  mycroft Fix vop_link, vop_symlink, and vop_remove semantics in several ways:
* Change the argument names to vop_link so they actually make sense.
* Implement vop_link and vop_symlink for all file systems, so they do proper
cleanup.
* Require the file system to decide whether or not linking and unlinking of
directories is allowed, and disable it for all current file systems.
(Also, remove the cross-device link check, that was moved into the file
systems some time ago.)
 1.20  01-Feb-1996  jtc Rename struct timespec fields to conform to POSIX.1b
 1.19  19-Dec-1995  cgd changes to make this work on systems where pointers & longs are 64 bits.
This is mostly just changes to make the stuff that goes over the wire
use fixed-size types.
 1.18  23-May-1995  mycroft Remove gratuitous extra indirections.
 1.17  13-Dec-1994  mycroft Sync with CSRG.
 1.16  29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.15  08-Jun-1994  mycroft Update to 4.4-Lite fs code, with local changes.
 1.14  21-Apr-1994  cgd Convert mount, vnode, and buf structs to use <sys/queue.h>. Also,
some knf and structure frobbing to do along with it.
 1.13  10-Apr-1994  cgd patchkit date deletions!
 1.12  12-Mar-1994  cgd fix rcs id
 1.11  09-Mar-1994  ws Make FFS optional
 1.10  18-Dec-1993  mycroft Canonicalize all #includes.
 1.9  26-Nov-1993  ws Bug fixes to ISOFS
 1.8  07-Sep-1993  ws branches: 1.8.2;
Changes to VFS readdir semantics
NFS changes for better cookie support
ISOFS changes for better Rockridge support and support for generation numbers
 1.7  03-Sep-1993  jtc Include systm.h to get prototypes (and possibly inlines) of *max functions.
 1.6  16-Jul-1993  cgd ANSI mods.
(originally committed by andrew on 1993/06/27 06:58:35)
 1.5  16-Jul-1993  cgd fix for macklem's bogus use of the va_flags field, supplied by
John Woods, jfwfrom: @ksr.com. also, fixes the following problems:
the va_gen field is in a similar position
(Suns are going to be reporting the change-date microseconds as their
"generation"), I've supplied my own set of diffs below for your inspection.
Note these aren't even compiled, but they're pretty similar to what I had
to do to our older version of OSF/1 here. (There's also an unrelated change
supplied for xdr_subs.h; the pointer types supplied to the fxdr_time() and
txdr_time() macros are not, in fact, both struct timevals. That turns out
to be one of many tips-of-the-iceberg facing those porting the (old) Berkeley
NFS code to 64-bit machines...)
(originally committed by cgd on 1993/06/03 01:12:42)
 1.4  16-Jul-1993  cgd more rcs id adding and header cleanup. i like vi macros!
(originally committed by cgd on 1993/05/20 03:18:44)
 1.3  10-Apr-1993  glass migrated code to make split possible
 1.2  21-Mar-1993  cgd after 0.2.2 "stable" patches applied
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.4  01-Mar-1998  fvdl Import some files that were changed after Lite2
 1.1.1.3  01-Mar-1998  fvdl Import 4.4BSD-Lite2
 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.8.2.3  26-Nov-1993  mycroft Merge changes from trunk.
 1.8.2.2  14-Nov-1993  mycroft Canonicalize all #includes.
 1.8.2.1  24-Sep-1993  mycroft Make all files using spl*() #include cpu.h. Changes from trunk.
nfs_vfsops.c, nfsmount.h: Make nfs_quotactl() take an int rather than a uid_t,
as it might be -1.
nfs_vnops.c: va_size and va_bytes are now quads.
 1.25.4.2  04-Mar-1997  mycroft Pull up bug fixes from -current, per fvdl.
 1.25.4.1  11-Dec-1996  mycroft From trunk:
Always call vnode_pager_uncache() when removing a file.
 1.29.2.1  12-Mar-1997  is Merge in changes from Trunk
 1.37.2.1  14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.38.2.2  01-Feb-1999  cgd pull up rev 1.46 from trunk (mrg)
 1.38.2.1  22-Dec-1997  perry pullup a fix to a critical NFS bug (fvdl)
 1.50.2.2  16-Dec-1999  he Pull up revision 1.52 (requested by fvdl):
Correct length check in readdirplus, making 32k readdir sizes
work.
 1.50.2.1  04-May-1999  perry branches: 1.50.2.1.2;
pullup 1.50->1.51 (sommerfeld)
 1.50.2.1.2.2  11-Jul-1999  chs remove uvm_vnp_uncache(), it's no longer needed.
 1.50.2.1.2.1  21-Jun-1999  thorpej Sync w/ -current.
 1.51.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.51.2.2  08-Dec-2000  bouyer Sync with HEAD.
 1.51.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.54.4.1  14-Dec-2000  he Pull up revision 1.58 (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.59.4.3  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.59.4.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.59.4.1  03-Aug-2001  lukem update to -current
 1.59.2.5  11-Dec-2002  thorpej Sync with HEAD.
 1.59.2.4  18-Oct-2002  nathanw Catch up to -current.
 1.59.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.59.2.2  26-Sep-2001  nathanw Catch up to -current.
Again.
 1.59.2.1  24-Aug-2001  nathanw Catch up with -current.
 1.60.2.1  01-Oct-2001  fvdl Catch up with -current.
 1.61.2.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.62.10.5  05-Jun-2004  jdc Pull up revision 1.89 (requested by yamt in ticket #1706).

nfsrv_create: fix an LP64 problem for exclusive create.
 1.62.10.4  10-Jul-2003  tron Pull up revision 1.80 (requested by bouyer in ticket #1373):
nfsrv_commit(): return success and don't do anything for requests which starts
past the end of the file. This can happen when two clients are writting to
the same file.
Close PR 21696 by myself, discussed on tech-net in 2003/05 and 2003/06.
Issue raised by Chuck Silvers (commit and truncate ops needs to be serialised)
still unadressed.
 1.62.10.3  30-Sep-2002  lukem Pull up revision 1.65 (requested by bouyer in ticket #880):
In nfs_commit(), sanity-check what we get from network: if we try to fluch
past end of file, or if off + cnt overflows a quad_t, flush to end of file.
 1.62.10.2  30-Sep-2002  lukem Pull up revision 1.63 (requested by bouyer in ticket #880):
nfsrv_commit(): Properly handle the case cnt == 0, which means "flush to
end of file". Calling VOP_FSYNC with start == end triggers a DIAGNOSTIC
check. Noticed with NFSv3 Linux clients. OK'd by fvdl.
 1.62.10.1  30-Sep-2002  lukem Pull up revision 1.64 (requested by bouyer in ticket #879):
In nfsrv_create(), kill an extra PNBUF_PUT() in the NFSv2 mknod case. The
pnbuf has already been freed by VOP_MKNOD. This should have been removed in
rev 1.60.
Should fix PR 18013, OK'd by fvdl.
 1.79.2.8  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.79.2.7  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.79.2.6  18-Dec-2004  skrll Sync with HEAD.
 1.79.2.5  21-Sep-2004  skrll Fix the sync with head I botched.
 1.79.2.4  18-Sep-2004  skrll Sync with HEAD.
 1.79.2.3  24-Aug-2004  skrll Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.79.2.2  03-Aug-2004  skrll Sync with HEAD
 1.79.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.87.2.1  05-Jun-2004  jdc Pull up revision 1.89 (requested by yamt in ticket #445).

nfsrv_create: fix an LP64 problem for exclusive create.
 1.93.4.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.93.2.1  29-Apr-2005  kent sync with -current
 1.95.2.12  17-Mar-2008  yamt sync with head.
 1.95.2.11  27-Feb-2008  yamt drop lazy mapping of mbuf external storage for now, because:
- it's currently broken wrt asm code. (cpu_in_cksum)
- there are other approaches worth to consider. eg. sf_buf
 1.95.2.10  27-Feb-2008  yamt sync with head.
 1.95.2.9  04-Feb-2008  yamt sync with head.
 1.95.2.8  21-Jan-2008  yamt sync with head
 1.95.2.7  07-Dec-2007  yamt sync with head
 1.95.2.6  27-Oct-2007  yamt sync with head.
 1.95.2.5  03-Sep-2007  yamt sync with head.
 1.95.2.4  26-Feb-2007  yamt sync with head.
 1.95.2.3  30-Dec-2006  yamt sync with head.
 1.95.2.2  21-Jun-2006  yamt sync with head.
 1.95.2.1  07-Jul-2005  yamt nfsrv_read: defer mbuf mapping.
 1.98.6.2  18-Nov-2005  yamt - associate read-ahead context to vnode, rather than file.
- revert VOP_READ prototype.
 1.98.6.1  15-Nov-2005  yamt adapt ffs, lfs, nfs.
 1.99.2.2  15-Jan-2006  yamt sync with head.
 1.99.2.1  31-Dec-2005  yamt - adapt nfs.
- nfs_doio_read: #if 0 out "killproc if text is modified" part of
the code as it's broken. (a process reading the modified text is not
necessarily a process which is using the file as a text.)
 1.100.4.3  01-Jun-2006  kardel Sync with head.
 1.100.4.2  22-Apr-2006  simonb Sync with head.
 1.100.4.1  04-Feb-2006  simonb Adapt for timecounters: mostly use get*time() and use "time_second"
instead of "time.tv_sec".
 1.100.2.1  09-Sep-2006  rpaulo sync with head
 1.101.6.2  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.101.6.1  28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.101.4.6  11-May-2006  elad sync with head
 1.101.4.5  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.101.4.4  19-Apr-2006  elad sync with head.
 1.101.4.3  12-Mar-2006  elad Get rid of NFSW_SAMECRED() that uses memcmp() to compare two credentials,
and use a new nfsrv_samecred(), using kauth(9).

Note that the NFSW_SAMECRED() macro used to check nd_flag of both
descriptors for NB_KERBAUTH too; we don't do that. [documented]

Based on code in FreeBSD, thanks to Jeff Roberson.
 1.101.4.2  10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.101.4.1  08-Mar-2006  elad Adapt to kernel authorization KPI.

This could use some testing...
 1.101.2.5  03-Sep-2006  yamt sync with head.
 1.101.2.4  11-Aug-2006  yamt sync with head
 1.101.2.3  26-Jun-2006  yamt sync with head.
 1.101.2.2  24-May-2006  yamt sync with head.
 1.101.2.1  01-Apr-2006  yamt sync with head.
 1.109.2.1  19-Jun-2006  chap Sync with head.
 1.111.2.1  13-Jul-2006  gdamore Merge from HEAD.
 1.117.4.2  10-Dec-2006  yamt sync with head.
 1.117.4.1  22-Oct-2006  yamt sync with head
 1.117.2.3  09-Feb-2007  ad Sync with HEAD.
 1.117.2.2  12-Jan-2007  ad Sync with head.
 1.117.2.1  18-Nov-2006  ad Sync with head.
 1.119.2.2  10-Mar-2007  bouyer Pull up following revision(s) (requested by chs in ticket #506):
sys/nfs/nfs_serv.c: revision 1.124
after freeing cookies, set the pointer to NULL to prevent dangling reuse
 1.119.2.1  17-Feb-2007  tron Apply patch (requested by chs in ticket #422):
- Fix various deadlock problems with nullfs and unionfs.
- Speed up path lookups by upto 25%.
 1.123.2.3  15-Apr-2007  yamt sync with head.
 1.123.2.2  12-Mar-2007  rmind Sync with HEAD.
 1.123.2.1  28-Feb-2007  yamt sync with head. (somehow missed in the previous)
 1.127.4.1  11-Jul-2007  mjf Sync with head.
 1.127.2.4  26-Aug-2007  yamt - mark nfssvc(2) MPSAFE and move the most of nfsd out of the kernel lock.
- remove unused ns_solock.
- remove some of KERNEL_LOCK/UNLOCK which are not necessary on this branch.
 1.127.2.3  20-Aug-2007  ad Sync with HEAD.
 1.127.2.2  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.127.2.1  10-Apr-2007  ad Sync with head.
 1.128.4.1  15-Aug-2007  skrll Sync with HEAD.
 1.129.10.2  27-Jul-2007  yamt stop nfs tick when we have nothing to do.
 1.129.10.1  27-Jul-2007  yamt file nfs_serv.c was added on branch matt-mips64 on 2007-07-27 10:03:59 +0000
 1.129.8.1  14-Oct-2007  yamt sync with head.
 1.129.6.3  23-Mar-2008  matt sync with HEAD
 1.129.6.2  09-Jan-2008  matt sync with HEAD
 1.129.6.1  06-Nov-2007  matt sync with HEAD
 1.129.4.3  09-Dec-2007  jmcneill Sync with HEAD.
 1.129.4.2  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.129.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.130.4.3  18-Feb-2008  mjf Sync with HEAD.
 1.130.4.2  27-Dec-2007  mjf Sync with HEAD.
 1.130.4.1  08-Dec-2007  mjf Sync with HEAD.
 1.131.2.3  26-Dec-2007  ad Sync with head.
 1.131.2.2  08-Dec-2007  ad Sync with head.
 1.131.2.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.132.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.135.6.2  17-Jan-2009  mjf Sync with HEAD.
 1.135.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.135.2.1  24-Mar-2008  keiichi sync with head.
 1.138.16.3  30-Sep-2012  bouyer Pull up following revision(s) (requested by chs in ticket #1794):
sys/nfs/nfs_serv.c: revision 1.164 via patch
fix error handling in nfsrv_rename(): when the first nfs_namei() fails,
don't try to free the resources allocated by a successful lookup.
 1.138.16.2  14-Feb-2010  bouyer Pull up following revision(s) (requested by pooka in ticket #1289):
sys/sys/namei.src: revision 1.14
sys/kern/vfs_syscalls.c: revision 1.401
sys/nfs/nfs_serv.c: revision 1.149
sys/sys/namei.h: regen
Define namei flag INRENAME and set it if a lookup operation is part
of rename. This helps with building better asserts for rename in
the DELETE lookup ... the RENAME lookup is quite obviously a part
of rename.
 1.138.16.1  13-Apr-2009  snj branches: 1.138.16.1.4;
Pull up following revision(s) (requested by ad in ticket #700):
sys/nfs/nfs_serv.c: revision 1.144
sys/nfs/nfsm_subs.h: revision 1.51
PR kern/41158: nfs_rename() locking against myself
nfsrv_rename() can exit without calling genfs_renamelock_exit() because
the nfsm_reply() can do return (0) on error.
Change nfsm_reply to use 'error = 0; goto nfsmout' instead.
Fix a few place so it's safe to goto nfsmout from nfsm_reply, or other
macros calling it.
As a side effect it could fix a missing vrele(dirp) in various place where
nfsm_reply could return(0).
 1.138.16.1.4.2  24-Dec-2011  matt Fix call to sokvaalloc (now takes 3 arguments)
 1.138.16.1.4.1  20-Apr-2010  matt Pullin some NFS fixes from netbsd-5.
 1.138.14.2  28-Apr-2009  skrll Sync with HEAD.
 1.138.14.1  19-Jan-2009  skrll Sync with HEAD.
 1.138.12.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.138.6.4  11-Aug-2010  yamt sync with head.
 1.138.6.3  11-Mar-2010  yamt sync with head
 1.138.6.2  20-Jun-2009  yamt sync with head
 1.138.6.1  04-May-2009  yamt sync with head.
 1.138.2.3  27-Dec-2008  christos merge with head.
 1.138.2.2  20-Nov-2008  christos merge with head.
 1.138.2.1  29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.142.2.2  23-Jul-2009  jym Sync with HEAD.
 1.142.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.150.4.3  21-Apr-2011  rmind sync with head
 1.150.4.2  05-Mar-2011  rmind sync with head
 1.150.4.1  03-Jul-2010  rmind sync with head
 1.150.2.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.155.4.1  08-Feb-2011  bouyer Sync with HEAD
 1.155.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.161.2.3  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.161.2.2  30-Oct-2012  yamt sync with head
 1.161.2.1  17-Apr-2012  yamt sync with head
 1.162.2.1  18-Feb-2012  mrg merge to -current.
 1.163.4.1  01-Nov-2012  matt sync with netbsd-6-0-RELEASE.
 1.163.2.2  03-Sep-2012  riz Pull up following revision(s) (requested by christos in ticket #537):
sys/nfs/nfs_serv.c: revision 1.165
When unloading the nfsserver module, call nfs_fini() so that the nfsrvdescpl
pool gets destroyed. Otherwise we are left with a stray pool that points to
unmapped memory behind (and bad things happen). Typically you get seemingly
random page faults (without printing uvm_fault) that happen in various pool
operations. Most frequent one is the pool_drain() from the page daemon.
 1.163.2.1  03-Sep-2012  riz Pull up following revision(s) (requested by chs in ticket #530):
sys/nfs/nfs_serv.c: revision 1.164
fix error handling in nfsrv_rename(): when the first nfs_namei() fails,
don't try to free the resources allocated by a successful lookup.
 1.165.4.1  18-May-2014  rmind sync with head
 1.165.2.2  03-Dec-2017  jdolecek update from HEAD
 1.165.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.170.6.2  28-Aug-2017  skrll Sync with HEAD
 1.170.6.1  06-Jun-2015  skrll Sync with HEAD
 1.173.10.2  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.173.10.1  21-May-2018  pgoyette Sync with HEAD
 1.173.4.1  30-Mar-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1810):

sys/nfs/nfs_serv.c: revision 1.184
sys/nfs/nfs_srvsubs.c: revision 1.17
sys/nfs/nfsm_subs.h: revision 1.56
sys/nfs/nfsm_subs.h: revision 1.57

nfs: Use unsigned fhlen so we don't trip over negative values.

nfs: Avoid integer overflow in nfs_namei bounds check.

nfs: Use unsigned name lengths so we don't trip over negative ones.
- nfsm_strsiz is only used with uint32_t in callers, but let's not
leave it as a rake to step on.
- nfsm_srvnamesiz is abused with signed s. The internal conversion
to unsigned serves to reject both negative and too-large values in
such callers.
XXX Should make all callers use unsigned, rather than flipping back
and forth between signed and unsigned for name lengths.

nfs: Avoid free of uninitialized on bad name size in create, mknod.
XXX These error branches are a nightmare and need to be more
systematically cleaned up. Even if they are correct now, they are
impossible to audit and extremely fragile in case anyone ever needs
to make other changes to them.
 1.174.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.174.2.1  10-Jun-2019  christos Sync with HEAD
 1.177.4.1  30-Mar-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1617):

sys/nfs/nfs_serv.c: revision 1.184
sys/nfs/nfs_srvsubs.c: revision 1.17
sys/nfs/nfsm_subs.h: revision 1.56
sys/nfs/nfsm_subs.h: revision 1.57

nfs: Use unsigned fhlen so we don't trip over negative values.

nfs: Avoid integer overflow in nfs_namei bounds check.

nfs: Use unsigned name lengths so we don't trip over negative ones.
- nfsm_strsiz is only used with uint32_t in callers, but let's not
leave it as a rake to step on.
- nfsm_srvnamesiz is abused with signed s. The internal conversion
to unsigned serves to reject both negative and too-large values in
such callers.
XXX Should make all callers use unsigned, rather than flipping back
and forth between signed and unsigned for name lengths.

nfs: Avoid free of uninitialized on bad name size in create, mknod.
XXX These error branches are a nightmare and need to be more
systematically cleaned up. Even if they are correct now, they are
impossible to audit and extremely fragile in case anyone ever needs
to make other changes to them.
 1.178.2.1  17-Jan-2020  ad Sync with head.
 1.183.4.1  30-Mar-2023  martin Pull up following revision(s) (requested by riastradh in ticket #134):

sys/nfs/nfs_serv.c: revision 1.184
sys/nfs/nfs_srvsubs.c: revision 1.17
sys/nfs/nfsm_subs.h: revision 1.56
sys/nfs/nfsm_subs.h: revision 1.57

nfs: Use unsigned fhlen so we don't trip over negative values.

nfs: Avoid integer overflow in nfs_namei bounds check.

nfs: Use unsigned name lengths so we don't trip over negative ones.
- nfsm_strsiz is only used with uint32_t in callers, but let's not
leave it as a rake to step on.
- nfsm_srvnamesiz is abused with signed s. The internal conversion
to unsigned serves to reject both negative and too-large values in
such callers.
XXX Should make all callers use unsigned, rather than flipping back
and forth between signed and unsigned for name lengths.

nfs: Avoid free of uninitialized on bad name size in create, mknod.
XXX These error branches are a nightmare and need to be more
systematically cleaned up. Even if they are correct now, they are
impossible to audit and extremely fragile in case anyone ever needs
to make other changes to them.

RSS XML Feed