Home | History | Annotate | Download | only in nfs
History log of /src/sys/nfs/nfs_vnops.c
RevisionDateAuthorComments
 1.325  10-Dec-2023  schmonz NFS client: fix interop with macOS 14 servers.

Symptom: a bunch of "Cannot open `.' (Invalid argument)".

thorpej@ analysis and fix: on the first request to read a given
directory, make sure READDIR and READDIRPLUS cookie verifiers are
being set to 0. This is in RFC1813 and macOS must have gotten
stricter about it.

Verified on 10.0_RC1/aarch64 to fix the reproducers in PR kern/57691 as
well as the original use case in which I met the bug: pkg_rr once again
runs to completion.
 1.324  24-May-2022  andvar branches: 1.324.4;
fix various typos in comments, docs and log messages.
 1.323  30-Mar-2022  christos restructure so we abort/unlock properly on failure.
 1.322  27-Mar-2022  christos add a kauth vnode check for creating links
 1.321  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.320  18-Jul-2021  dholland Abolish all the silly indirection macros for initializing vnode ops tables.

These are things of the form #define foofs_op genfs_op, or #define
foofs_op genfs_eopnotsupp, or similar. They serve no purpose besides
obfuscation, and have gotten cutpasted all over everywhere.
 1.319  18-Jul-2021  dholland Use macros for the canned parts of device and fifo vnode op tables.

Add GENFS_SPECOP_ENTRIES and GENFS_FIFOOP_ENTRIES macros that contain
the portion of the vnode ops table declaration that is
(conservatively) the same in every fs. Use these in every fs that
supports devices and/or fifos with separate ops tables.

Note that ptyfs works differently (it has one type of vnode with
open-coded dispatch to the specfs code, which I haven't changed in
this commit) and rump/librump/rumpvfs/rumpfs.c has an indirect dynamic
dispatch that already does more or less the same thing, which I also
haven't changed.

Also note that this anticipates a few bits in the next changeset here
and there, and adds missing but unreachable calls in some cases (e.g.
most fses weren't defining whiteout on devices and fifos, but it isn't
reachable there), and it changes parsepath on devices and fifos to
genfs_badop from genfs_parsepath (but it's not reachable there
either).

It appears that devices in kernfs were missing kqfilter, so it's
possible that if you try to use kqueue on /kern/rootdev that it'll
explode.

And finally note that the ops declaration tables aren't
order-dependent. (Other than vop_default_desc has to come first.)
Otherwise this wouldn't work.
 1.318  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.317  05-Sep-2020  riastradh branches: 1.317.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.316  27-Jun-2020  christos Introduce genfs_pathconf() and use it for the default case in all filesystems.
 1.315  16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.314  13-Apr-2020  ad Replace most uses of vp->v_usecount with a call to vrefcnt(vp), a function
that hides the details and does atomic_load_relaxed(). Signature matches
FreeBSD.
 1.313  23-Feb-2020  ad branches: 1.313.4;
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.312  10-Sep-2019  christos branches: 1.312.2;
remove NCHNAMLEN optimization
 1.311  03-Sep-2018  riastradh branches: 1.311.4;
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.310  26-Apr-2017  riastradh branches: 1.310.4; 1.310.10; 1.310.12;
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.309  19-Jan-2016  hannken Return an error if NFSPROC_LOOKUP returns the file handle of the current
directory. Treating it as DOT lookup would put garbage into the name
cache and could panic on future lookups.

Seen with ZFS file system exported from OmniOS, an OpenSolaris derivative.

Fixes PR kern/50664 "cd .." over NFS/ZFS can panic kernel
 1.308  14-May-2015  chs in nfs_writerpc(), avoid a signed/unsigned problem in computing the
number of bytes to back up in the uio when we need to resend a write RPC
(eg. after a server crash) on a 64-bit platform. should fix PR 35448.
 1.307  20-Apr-2015  riastradh Make VOP_LINK return directory still locked and referenced.

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

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

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

The fifo ones all call vn_fifo_bypass, which also ends up being
EOPNOTSUPP.
 1.305  05-Jul-2014  hannken Use vcache_rekey_* for nfs_lookitup() in the "*npp != NULL" case.
 1.304  07-Feb-2014  hannken branches: 1.304.2;
Change vnode operation lookup to return the resulting vnode *vpp unlocked.
Change cache_lookup() to return an unlocked vnode.

Discussed on tech-kern@

Welcome to 6.99.31
 1.303  23-Jan-2014  hannken Change vnode operations create, mknod, mkdir and symlink to return
the resulting vnode *vpp unlocked.

Discussed on tech-kern@

Welcome to 6.99.30
 1.302  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.301  15-Nov-2013  nisimura add one more __unused attribute to shut gcc4.8 off.
 1.300  14-Sep-2013  martin Backout wildcard pragma to kill warnings and instead sprinkle a few dozen
__unused attributes.
Requested by joerg@
 1.299  18-Mar-2013  plunky branches: 1.299.6;
C99 section 6.7.2.3 (Tags) Note 3 states that:

A type specifier of the form

enum identifier

without an enumerator list shall only appear after the type it
specifies is complete.

which means that we cannot pass an "enum vtype" argument to
kauth_access_action() without fully specifying the type first.
Unfortunately there is a complicated include file loop which
makes that difficult, so convert this minimal function into a
macro (and capitalize it).

(ok elad@)
 1.298  07-Nov-2012  macallan fix crash in nfs client lookups, dholland says 'my fault'
 1.297  05-Nov-2012  dholland Excise struct componentname from the namecache.

This uglifies the interface, because several operations need to be
passed the namei flags and cache_lookup also needs for the time being
to be passed cnp->cn_nameiop. Nonetheless, it's a net benefit.

The glop should be able to go away eventually but requires structural
cleanup elsewhere first.

This change requires a kernel bump.
 1.296  05-Nov-2012  dholland Disentangle the namecache from the internals of namei.

- Move the namecache's hash computation to inside the namecache code,
instead of being spread out all over the place. Remove cn_hash from
struct componentname and delete all uses of it.

- It is no longer necessary (if it ever was) for cache_lookup and
cache_lookup_raw to clear MAKEENTRY from cnp->cn_flags for the cases
that cache_enter already checks for.

- Rearrange the interface of cache_lookup (and cache_lookup_raw) to
make it somewhat simpler, to exclude certain nonexistent error
conditions, and (most importantly) to make it not require write access
to cnp->cn_flags.

This change requires a kernel bump.
 1.295  22-Jul-2012  rmind branches: 1.295.2;
Move some the test for MAKEENTRY into the cache_enter(9). Make some
variables in vfs_cache.c static, __read_mostly, etc.

No objection on tech-kern@.
 1.294  27-Apr-2012  drochner fix access permission check which got broken by some kauth rework
in March, affected mostly systems with NFS root fs
 1.293  28-Nov-2011  tls branches: 1.293.2; 1.293.4;
Remove arc4random() and arc4randbytes() from the kernel API. Replace
arc4random() hacks in rump with stubs that call the host arc4random() to
get numbers that are hopefully actually random (arc4random() keyed with
stack junk is not). This should fix some of the currently failing anita
tests -- we should no longer generate duplicate "random" MAC addresses in
the test environment.
 1.292  27-Sep-2011  christos branches: 1.292.2;
use NFS_MAXPATHLEN instead of MAXPATHLEN
 1.291  12-Jun-2011  rmind Welcome to 5.99.53! Merge rmind-uvmplock branch:

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

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

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

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

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

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.290  24-Apr-2011  rmind branches: 1.290.2;
sys_link: prevent hard links on directories (cross-mount operations are
already prevented). File systems are no longer responsible to check this.
Clean up and add asserts (note that dvp == vp cannot happen in vop_link).

OK dholland@
 1.289  14-Dec-2010  cegger branches: 1.289.2;
Initialize mutex and cv after sanity checks
 1.288  14-Dec-2010  cegger back out rev. 1.285. The problem I try to hunt down
in PR 42455 is not in the network stack as shown by PR 44206.
 1.287  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.286  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.285  26-Oct-2010  cegger Add diagnostic check which hits when PR 42455 is reproduced.
Idea from hans@
 1.284  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.283  29-Mar-2010  pooka Stop exposing fifofs internals and leave only fifo_vnodeop_p visible.
 1.282  08-Jan-2010  pooka branches: 1.282.2; 1.282.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.281  21-Oct-2009  rmind Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.280  14-Jul-2009  apb Use pid_t, not short, for a pid.
Part of PR 41255 from Kurt Lidl.
 1.279  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.278  10-May-2009  yamt nfs_lookup: vn_lock the vnode returned by cache_lookup_raw
before feeding it to VOP_GETATTR. it's necessary because the vnode might
be being cleaned by getcleanvnode.

it's an instance of more general races between vnode reclaim and
unlocked VOPs. however, this one happens somewhat often because it can be
triggered by getnewvnode rather than revoke.
 1.277  10-May-2009  yamt restore lines, esp. a vrele() call, which i mistakenly removed
in the previous. (rev.1.276)
 1.276  04-May-2009  yamt nfs_lookup: handle the case where the vnode returned cache_lookup_raw is
being reclaimed by another thread. after recent changes in cache_lookup_raw,
there's a race between cache_lookup_raw/vtryget and getcleanvnode/vclean.
PR/41028.
 1.275  04-May-2009  yamt nfs_lookup: add an assertion.
 1.274  04-May-2009  yamt nfs_lookup: comments. no functional changes.
 1.273  14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.272  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.271  14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.270  13-Mar-2009  yamt nfs_lookup: fix a comment.
 1.269  11-Jan-2009  christos branches: 1.269.2;
merge christos-time_t
 1.268  19-Nov-2008  ad branches: 1.268.4;
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.267  15-Oct-2008  pooka branches: 1.267.2;
For NFSV3CREATE_EXCLUSIVE verifier, just use arc4random() instead
of the first inet address on INET systems (which is likely to be
localhost).
 1.266  13-Feb-2008  yamt branches: 1.266.6; 1.266.10; 1.266.16;
reject files larger than nm_maxfilesize.
 1.265  25-Jan-2008  ad Remove VOP_LEASE. Discussed on tech-kern.
 1.264  02-Jan-2008  yamt use kmem_alloc instead of malloc.
 1.263  02-Jan-2008  ad Merge vmlocking2 to head.
 1.262  17-Dec-2007  yamt nfs_create: try GUARDED if EXCLUSIVE is NOTSUPP.
 1.261  08-Dec-2007  pooka branches: 1.261.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.260  26-Nov-2007  pooka branches: 1.260.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.259  13-Nov-2007  yamt nfs_lookup: fix indent.
 1.258  07-Nov-2007  ad Merge from vmlocking:

- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.
 1.257  28-Oct-2007  yamt branches: 1.257.2;
make NFS_ATTRTIMEO a function.
 1.256  09-Jul-2007  ad branches: 1.256.6; 1.256.8; 1.256.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.255  29-Apr-2007  yamt don't forget to destroy mutex and condvar.
 1.254  29-Apr-2007  yamt use mutex and condver.
 1.253  29-Apr-2007  yamt use mutex and condvar.
 1.252  04-Mar-2007  christos branches: 1.252.2; 1.252.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.251  22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.250  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.249  24-Jan-2007  hubertf branches: 1.249.2;
Remove duplicate #includes, patch contributed in private mail
by Slava Semushin <slava.semushin@gmail.com>.

To verify that no nasty side effects of duplicate includes (or their
removal) have an effect here, I've compiled an i386/ALL kernel with
and without the patch, and the only difference in the resulting .o
files was in shifted line numbers in some assert() calls.
The comparison of the .o files was based on the output of "objdump -D".

Thanks to martin@ for the input on testing.
 1.248  27-Dec-2006  yamt - remove the rest of nqnfs.
- reject NFSMNT_MNTD and NFSMNT_KERB. (no users in tree.)
 1.247  27-Dec-2006  yamt remove nqnfs.
 1.246  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.245  09-Nov-2006  yamt branches: 1.245.2;
remove some __unused in function parameters.
 1.244  14-Oct-2006  yamt grab glock when calling uvm_unp_setsize, so that it doesn't interfere
mmap'ed accesses. this fixes an assertion failure in in nfs_doio_read.
("vp->v_size >= uiop->uio_offset + uiop->uio_resid")
 1.243  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.242  29-Sep-2006  drochner Flush regular files before setattr also if the mode bits are going to
be set. Linux NFS servers (at least) reset suid/sgid bits if a write
happens afterwards. Add a comment why this is done.
This fixes system builds on diskless systems for me where suid bits
were missing after install(1).
Approved by yamt.
 1.241  23-Jul-2006  ad branches: 1.241.4; 1.241.6;
Use the LWP cached credentials where sane.
 1.240  01-Jul-2006  yamt some comments taken from Jed Davis's patch.
 1.239  01-Jul-2006  yamt if a file is sillyrename'ed because it's a destination of rename,
make sillyrename (try to) use LINK operation rather than RENAME.
PR/33861 from Jed Davis. he provided the almost same patch.
according to him, it also happen to be what opensolaris does in this case.

from the PR:
> In nfs_rename(), if the destination appears to exist and is "in use"
> (this check is apparently satisfied even if the file isn't in use by
> anything except the rename itself), it will sillyrename it, then delete
> the sillyrenamed file even if the rename fails -- for instance, because
> the "from" file no longer exists on the server.

> mkdir a b; touch a/x; perl -e 'fork(); rename("a/x","b/x") or die "$!\n"'
>
> Afterwards, neither a/x nor b/x will exist.

> 1) Lookup of b/x; fails with NOENT.
> 2) Rename from a/x to b/x; succeeds.
> 3) Lookup of b/x; fails with NOENT.
> 4) Rename from b/x to b/.nfsA23a3; succeeds.
> 5) Rename from a/x to b/x; fails with NOENT.
> 6) Remove of b/.nfsA23a3; succeeds.
 1.238  30-Jun-2006  yamt fix handling of NFSERR_NOTSUPP and NFSERR_BAD_COOKIE,
which have been broken since nfs_socket.c rev.1.115.
 1.237  07-Jun-2006  kardel branches: 1.237.2;
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.236  14-May-2006  elad branches: 1.236.2;
integrate kauth.
 1.235  15-Apr-2006  christos Coverity CID 744: Conditionally define out dead code (only if it is dead)
 1.234  15-Apr-2006  christos Coverity CID 2515-2519: Initialize rexmit on error path.
 1.233  15-Apr-2006  christos Coverity CID 2520: rexmit can be uninitialized on error path.
 1.232  14-Apr-2006  blymn Make i/o statistics collection more generic, include tape drives and
nfs mounts in the set of devices that statistics will be reported on.
 1.231  01-Mar-2006  yamt branches: 1.231.2; 1.231.4; 1.231.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.230  11-Dec-2005  christos branches: 1.230.2; 1.230.4; 1.230.6;
merge ktrace-lwp.
 1.229  05-Nov-2005  yamt branches: 1.229.2;
nfs_read: return EISDIR rather than EPERM for !VREG files.
 1.228  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.227  19-Sep-2005  christos branches: 1.227.2;
ATTRTIMEO takes 2 args.
 1.226  19-Aug-2005  yamt fix some simple bugs in the 64bit ino_t changes.
- edp -> dp
- * -> +
 1.225  19-Aug-2005  christos 64 bit inode changes.
 1.224  21-Jul-2005  yamt use a correct credential for readlink. discussed on source-changes@.
 1.223  07-Jul-2005  christos 1. use p = uio->uio_procp consistently and eliminate suspicious uses
of curproc (where uio->uio_procp should be used?). Don't do this
for nfs_commit(), because yamt says it is possibly wrong.
2. nfs_doio() does not use struct proc; remove it and the code to compute it.
3. use copyin_proc() and copyout_proc() instead of copyin() and copyout().
4. check return of copyout_proc(). and mark return from copyin_proc() XXX
5. Eliminate check p == curproc assertion check from nfs_write;
nfs_read does not have it and we might be called in a different
process context anyway (PR 20138).
 1.222  29-May-2005  christos branches: 1.222.2;
- sprinkle const
- avoid shadowed variables
- mark bad const use with XXXUNCONST
 1.221  17-May-2005  christos Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
 1.220  26-Feb-2005  perry branches: 1.220.2;
nuke trailing whitespace
 1.219  26-Jan-2005  yamt nfs_readdirrpc, nfs_readdirplusrpc:
avoid infinite loops when getting readdir response without
any entries or eof. PR/28971.
 1.218  26-Jan-2005  yamt handle a really empty directory, which doesn't have even the dot entry.
 1.217  21-Jan-2005  yamt branches: 1.217.2;
s/time/mono_time/ for n_attrstamp and n_accstamp. (parts of) PR/25641.
 1.216  19-Jan-2005  yamt implement inaccurate mtime/ctime detection.
namely, if mtime or ctime are same between pre_op_attr and post_op_attr
when we expected them to be changed, don't trust the server.
 1.215  08-Jan-2005  yamt branches: 1.215.2;
nfs_lookup: check n_nctime for positive entries as well to improve
cache consistency.
 1.214  17-Dec-2004  yamt revive spec vop_bwrite as it's needed for block devices.
PR/28684 from Jukka Salmi.
 1.213  14-Dec-2004  yamt redirect some VOPs which shouldn't be used for nfs
to genfs_badop (ie. panic).
 1.212  14-Dec-2004  yamt - centerize code to invalidate stale cache.
- don't ignore errors when invalidating buffers in nfs_open.
 1.211  03-Oct-2004  yamt nfs_readdirrpc, nfs_readdirplusrpc:
don't expose kernel garbage data to userland.
 1.210  01-Oct-2004  yamt nfs_writerpc: fix PHOLD leak on error.
 1.209  23-Sep-2004  yamt nfs_readdirplusrpc: fix spurious EBUSYs.
 1.208  20-Jul-2004  yamt nfs_readdirplusrpc: fix a very long-standing cache corruption bug.
in the case of !bigenough, don't fill d_type or dnlc with bogus data.
 1.207  20-Jul-2004  yamt revert nfs_vnops.c rev.1.189.
it's no longer needed because cache_enter() has been changed to handle
duplicated entries by itsself.
 1.206  18-Jul-2004  yamt nfs_commit: use NAC_NOTRUNC when loading an attribute
as we're called holding pages locked.
 1.205  08-Jul-2004  yamt - include opt_inet.h for INET.
- catchup to in_ifaddr -> in_ifaddrhead rename.

XXX the address on the top of in_ifaddrhead is likely 127.0.0.1.
using it to construct the verifier doesn't make much sense.
maybe it's better to use some uuid or ip_randomid-like method.
 1.204  08-Jul-2004  yamt nfs_create: after an exclusive create rpc, make sure to update
timestamps, which were likely used to store the verifier.
reported by Mark Davies. PR/26200
 1.203  27-Jun-2004  yamt nfs_lookup: use cache_lookup_raw() so that:
- "intrusive" dirops now have more chances to get benefits from dnlc.
- fixes a deadlock due to vnode locking order inversion.

nfs_create and others: purge stale dnlc entries
as nfs_lookup() no longer does it automatically.
 1.202  16-Jun-2004  yamt nfs_lookup: maintain PDIRUNLOCK even in the case of success to make
layered filesystems happy.
 1.201  27-May-2004  yamt remove an unused instance of VOP_UPDATE.
 1.200  23-May-2004  christos cut down another 7K by more NFS_V2_ONLY ifdefs.
 1.199  17-May-2004  yamt #if 0 out CREATE optimization for now because it has a problem in the case
of O_CREAT|O_TRUNC, which is hard to be fixed without changing upper layer.
 1.198  10-May-2004  yamt nfs_lookup: handle "." by ourselves as RFC1813 3.2 says.
 1.197  10-May-2004  yamt don't do kludge for a reply to a retransmitted request
unless we actually retransmitted the request.
 1.196  08-May-2004  yamt nfs_lookup: avoid CREATE optimization for DOTDOT.
creating a DOTDOT entry has no sense and will fail anyway.
 1.195  08-May-2004  yamt nfs_mkdir: handle the "." case.
 1.194  08-May-2004  yamt nfs_lookitup: handle "." correctly rather than returning garbage on the stack.
 1.193  07-May-2004  yamt check read only mount appropriately.
(fix a bug of nfs_vnops.c rev.1.192.)
pointed by Rob Quinn on current-users@.
 1.192  06-May-2004  yamt because nfsv3 has the same CREATE semantics as ours,
we don't have to issue LOOKUP RPCs beforehand.
 1.191  05-Apr-2004  yamt nfs_readdirplusrpc: fix a deadlock problem.
don't wait for vnode lock to load attributes.
otherwise, because READDIRPLUS returns DOTDOT entry as well,
we violate locking order.
 1.190  05-Apr-2004  yamt don't issue VOP_GETATTR blindly in nfs_nget().
in many cases, GETATTR RPCs here is redundant because the caller has
postop_attr. instead, make sure the resulted vnode have a valid
attribute in nfs_lookup().
 1.189  05-Apr-2004  yamt nfs_readdirplusrpc: purge existing namecache entry before entering a new one.
otherwise we'll get duplicated entries.
 1.188  05-Apr-2004  yamt when entering a namecache entry for nfs, ensure to update the appropriate
timestamp in the nfsnode so that we don't get namecache-miss when
looking up the node we just created.
 1.187  05-Apr-2004  yamt avoid unnecessary namecache purges in some places.
 1.186  12-Mar-2004  yamt branches: 1.186.2;
shrink sizeof struct nfsnode by putting exclusive members into union.
 1.185  12-Mar-2004  yamt introduce a macro NFS_INVALIDATE_ATTRCACHE and use it
instead of "n_attrstamp = 0".
 1.184  07-Dec-2003  fvdl Unix semantics dictate that access checks for files are done when it
is opened. An open file can always be read from and/or written to,
depending on how it was opened.

Therefore, the read/write/commit RPCs should never return EACCESS,
as they are only performed on files that have been successfully opened
already.

This change improves the current situation and works in most cases.
It simply always uses the most recently known owner/group of the file,
iff the authentication mechanism is AUTH_UNIX (in other cases, the
creds for a succesful open are used, but note that no other cases
are currently implemented).

A retry mechanism can be used to catch a few more cases, but this is
a good improvement for now.
 1.183  29-Nov-2003  yamt pad requests correctly in the zerocopy case of write rpc.
 1.182  25-Oct-2003  christos fix uninitialized variable
 1.181  26-Sep-2003  yamt do delayed truncation in nfs_getattr.
 1.180  26-Sep-2003  yamt change n_mtime from time_t to timespec in order to improve
cache consistency.
(1 second granularity is too loose these days.)
 1.179  25-Sep-2003  enami Make negative name cache works again.
 1.178  17-Sep-2003  yamt change nctime to timespec from time_t.
there can be too many activities in a second.
 1.177  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.176  30-Jul-2003  yamt vrecycle removed nfs vnodes.
not perfect, but enough for most cases.
 1.175  29-Jun-2003  fvdl branches: 1.175.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.174  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.173  27-Jun-2003  yamt if nfs_writerpc() splitted an unstable write into some rpcs and
write verifier was changed, we should restart from the first.
 1.172  27-Jun-2003  yamt indent.
 1.171  03-Jun-2003  yamt fix a problem in 'protected' case of writerpc.

retransmitted mbufs can survive even after requests themselves
finished. so, before unbusy pages, make sure that mbufs referring them
go away.

pointed by enami tsugutomo on port-mips.
 1.170  27-May-2003  yamt fix a memory leak bug that i introduced in rev.1.167.
patch provided by enami tsugutomo on current-users.
 1.169  26-May-2003  yamt when a result of NFSv3 READLINK is too long for us,
return ENAMETOOLONG rather than EBADRPC.
(it's our implementation limit, not protocol limit.)
 1.168  21-May-2003  yamt remove local definitions of TRUE and FALSE.
 1.167  21-May-2003  yamt eliminate memcpy in the common and easy case of write.
 1.166  03-May-2003  yamt better handling of write verifier change.
 1.165  24-Apr-2003  drochner Change some subordinate functions to take a "struct nfsnode" argument
instead of "struct vnode". This saves a number of pointer dereferences;
it sums up to about half a kB for me. And it paves the way for future
fixes.
While cleaning up, eliminate a write-only member of "struct nfsreq"
and a pointless assignment in the NFS_V2_ONLY case.
 1.164  09-Apr-2003  yamt rename a very confusing variable name.
(must_commit -> stalewriteverf)
 1.163  09-Apr-2003  yamt make per-iod datas together.
 1.162  09-Apr-2003  yamt rename nm_verf to nm_writeverf because it's confusing with nm_verf{str,len}.
 1.161  02-Apr-2003  yamt use queue manipulation macros.
 1.160  31-Mar-2003  yamt rename fvdl_debug to NFS_DEBUG_COMMIT.

ok'ed by fvdl.
 1.159  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.158  18-Feb-2003  jdolecek add missing dot in comment
 1.157  01-Dec-2002  matt Make sure these all agree on the same definitons of various variables.
 1.156  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.155  22-Oct-2002  yamt fix panic introduced by my previous commit.

for device special files, VOP_UNLOCK is called
by nfs_loadattrcache with v_data == 0.

reported and tested by Matthias Drochner.
 1.154  22-Oct-2002  simonb "nmp" in nfs_lookup() is set but not used, remove it.
 1.153  21-Oct-2002  yamt fix a page locking deadlock problem for nfs.

add a flag that specify if the file can be truncated safely or not
to nfsm_loadattr and friends. when it isn't safe, just mark the nfsnode
as "should be truncated later".

ok'ed by Frank van der Linden and Chuck Silvers.
close kern/18036.
 1.152  18-Oct-2002  thorpej nfs_remove(): Don't vput() the vnode twice if vp == dvp, vrele() and
vput() instead.
 1.151  19-May-2002  tls branches: 1.151.2;
Fix client-side lockmgr: locking against myself panic immediately upon an
attempt to NFS-mount a filesystem with the -l (use ReaddirPlus RPC) option.

Fix from Bill Sommerfeld.
 1.150  12-May-2002  matt branches: 1.150.2;
Eliminate commons
 1.149  28-Feb-2002  fvdl Invalidate the access cache when loading a new set of attributes into
the atribute cache. Fixes access cache problem seen by
Nathan Funk of the UofS, relayed by Greg Oster.
 1.148  15-Dec-2001  fvdl Set np->n_size before calling nfs_vinvalbuf, to avoid recursion
and confusion about the actual filesize. From Matt Dillon's
similar change in FreeBSD.

XXX n_size is really redundant in -current and must die. This commit
XXX is more of a placeholder for a pullup into the 1.5 branch.
 1.147  08-Dec-2001  lukem - Implement
uint32_t namei_hash(const char *p, const char **ep)
which determines the equivalent MI hash32_str() hash for p.
If *ep != NULL, calculate the hash to the character before ep.
If *ep == NULL, calculate the has to the first / or NUL found, and
point *ep to that location.
- Use namei_hash() to calculate cn_hash in lookup() and relookup().
Hash distribution goes from 35-40% to 55-70%, with similar profiled
time spent in cache_lookup() and cache_enter() on my P3-600.
- Use namei_hash() to calculate cn_hash in nfs_readdirplusrpc(),
insetad of homegrown code (that differed from that in lookup() !)
namei_hash() has better spread and is faster than previous code
(which used a non-constant multiplication).
 1.146  04-Dec-2001  christos PR/14817: Gregory McGarry: NFS_V2_ONLY doesn't seem to work.
 1.145  30-Nov-2001  chs call VOP_PUTPAGES() directly instead of indirecting through
the UVM pager op vector.
 1.144  29-Nov-2001  christos PR/14776: Emmanuel Dreyfus: cross device hard link causes panic.
Call VOP_ABORTOP on the right vnode damnit!
 1.143  10-Nov-2001  lukem add RCSIDs
 1.142  07-Nov-2001  bjh21 Diagnostic panics should be enabled when DIAGNOSTIC is defined, not undefined.
 1.141  13-Oct-2001  simonb branches: 1.141.2;
Remove so variables that are only ever set and never referenced.
 1.140  22-Sep-2001  sommerfeld Add fifo_putpages() placebo so that the vnode's uobj is unlocked.
 1.139  20-Sep-2001  chs fix nfs_bmap() so that it works for both genfs_{get,put}pages() and swap/vnd.
 1.138  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.137  17-Aug-2001  chs branches: 1.137.2;
add getpages/putpages entries for spec vnodes.
 1.136  14-Aug-2001  itojun don't panic on mknod(2) over NFS. PR 13705.
 1.135  24-Jul-2001  assar 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.134  07-Jun-2001  lukem branches: 1.134.2;
delint lvalue cast abuse
 1.133  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.132  14-May-2001  fvdl Lock vp in nfs_link while we're busy with it (doing VOP_FSYNC, etc).
 1.131  20-Apr-2001  fvdl Don't forget to unlock the vnode returned by cache_lookup if the
subsequent access check fails. Don't overwrite the error code
returned by cache_lookup. Remove a piece of redundant code.

Should fix kern/12680.
 1.130  11-Feb-2001  enami branches: 1.130.2;
Unlock the rename target vnode after sillyrename'ing it.
 1.129  06-Feb-2001  fvdl Get locking in rmdir right. Don't unlock a vnode when passing its
associated nfsnode to nfs_lookitup, it is not needed, and fixes
nfs_remove.
 1.128  06-Feb-2001  fvdl Do actual vnode locking for NFS.
 1.127  22-Jan-2001  jdolecek make filesystem vnodeop, specop, fifoop and vnodeopv_* arrays const
 1.126  12-Dec-2000  chs initialize read creds in nfs_open() too.
 1.125  30-Nov-2000  chs in nfs_open(), initialize the write creds if we're opening for writing.
otherwise we would never set them if we only modify the file via mmap().
 1.124  27-Nov-2000  chs Initial integration of the Unified Buffer Cache project.
 1.123  08-Nov-2000  chs in nfs_flush(), only play games with B_NOCACHE for VREG vnodes.
if we do this for VBLK vnodes which are in use by softdep mounts,
brelse() will mark the buffer B_INVAL as well, which makes the
softdep code very unhappy.
 1.122  02-Oct-2000  itojun check in_ifaddr only if INET is compiled
 1.121  19-Sep-2000  bjh21 Extend NFS_V2_ONLY to remove NQNFS lease support as well. Saves another 10k.
 1.120  19-Sep-2000  fvdl Update for VOP_FSYNC parameter change. Simplify nfs_flush.
 1.119  19-Sep-2000  bjh21 New kernel option, NFS_V2_ONLY, which aims to reduce the NFS client to just
that required to support NFSv2 mounts. Not finished yet, but already
provides some 44k of saving in code size on arm26. More savings, and some
documentation, are still to come.
 1.118  19-Sep-2000  fvdl Fix bug in access cache that might result in permission being denied
needlessly. From Matthias Drochner.
 1.117  03-Aug-2000  thorpej Convert namei pathname buffer allocation to use the pool allocator.
 1.116  03-Aug-2000  thorpej MALLOC()/FREE() are not to be used for variable size allocations.
 1.115  22-Jul-2000  jdolecek change the lf_advlock() arguments from

int lf_advlock __P((struct lockf **,
off_t, caddr_t, int, struct flock *, int));
to

int lf_advlock __P((struct vop_advlock_args *, struct lockf **, off_t));

This matches common usage and is also compatible with similar change
in FreeBSD (though they use u_quad_t as last arg).
 1.114  27-Jun-2000  mrg remove include of <vm/vm.h>
 1.113  26-May-2000  enami branches: 1.113.4;
- Try to commit another buffer even if previous commit failed except the
case that write verf is changed. Suggested by mycroft@netbsd.org.
- Reset wcred to NULL (i.e., write credential isn't decieded) everytime
before gathering buffer for new commit, so that there is a chance to
the commit request is merged.
 1.112  25-May-2000  enami In nfs_flush, if the previous commit succeeded and we may have more
uncommitted dirty buffer, attempt to commit them.
 1.111  30-Mar-2000  augustss Remove more register declarations.
 1.110  30-Mar-2000  augustss Remove register declarations.
 1.109  30-Mar-2000  simonb Delete redundant decls of fifo_vnodeop_p - it's in <miscfs/fifofs/fifo.h>.
Don't need <sys/conf.h> here.
 1.108  29-Nov-1999  fvdl Insert an extra VOP_ACCESS check in nfs_lookup, to avoid cached access
mishaps for lookup and getattr. Closes PR 8884.

While at it, cache access RPCs.
 1.107  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.106  05-Sep-1999  jdolecek branches: 1.106.2; 1.106.4; 1.106.8;
Adapt to cache_lookup() changes.
XXX I had no chance to actually test the changes for nfs, but hopefully I got
it right.

Tested by: jdolecek
Rewieved by: wrstuden
 1.105  03-Aug-1999  wrstuden 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.104  02-Aug-1999  wrstuden Teach nfs_lookup() to set PDIRUNLOCK when appropriate. Should resolve
PR 8051 by Konrad Schroder.
 1.103  29-Jul-1999  thorpej In nfs_create(), make sure error is reset to 0 if we restart the operation.
 1.102  08-Jul-1999  wrstuden Teach nfs_lookup to clear PDIRUNLOCK.
 1.101  29-May-1999  fvdl Be more correct with attribute structures for setattr RPCs and friends,
so that picky servers (e.g. Solaris 7) don't refuse our requests. Move
some code into a macro, and a bit of KNF. From OpenBSD.
 1.100  24-Mar-1999  mrg branches: 1.100.2; 1.100.4; 1.100.6;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.99  22-Mar-1999  kleink Add _PC_FILESIZEBITS to pathconf vnop.
 1.98  06-Mar-1999  fair Snatch a patch from OpenBSD to fix PRs 6529 and 7074.
Adjust fxdr_hyper() and txdr_hyper() macros.
 1.97  09-Aug-1998  perry branches: 1.97.2;
bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.96  08-Aug-1998  kleink Pathconf: for V2 mounts, revert back to failing with EINVAL if an RPC would
be necessary to obtain the information, as this fits the pathconf semantics
of `no association supported' better than `no limit available.'
 1.95  07-Aug-1998  kleink Add client pathconf support.
 1.94  24-Jun-1998  sommerfe Always include fifos; "not an option any more".
 1.93  22-Jun-1998  sommerfe defopt for options FIFO
 1.92  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.91  08-May-1998  kleink Fix some arithmetics lossage on typeless pointers.
 1.90  03-Mar-1998  fvdl Fix cookie handling I messed up totally when doing the Lite2 thing.
(Hello McFly? Anybody home?)
 1.89  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.88  10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.87  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.86  20-Oct-1997  thorpej Fix alignment problems. From Frank van der Linden <fvdl@NetBSD.ORG>.
 1.85  19-Oct-1997  fvdl * Implement optional 32 <-> 64 bit directory cookie translation. This uses
the directory cache as translation table. See nfs_subs.c for comments.
Makes the code a bit more complex to look at than I would have liked,
but doesn't affect the speed of the default behavior.
* Optimize caching behavior a bit when buffers are invalidated.
* Save some RPCs in readdir operations by not bothering if there is
a small amount left to do to fill the buffer. It'll be done in the
next RPC with a larger chunk anyway. Wastes a bit of buffer space
but is faster.
* Make n_vattr an allocated vattr struct. This avoids nfsnode bloat,
and is friendlier to the malloc routines.
 1.84  17-Oct-1997  christos u_short -> mode_t
 1.83  13-Oct-1997  fvdl Get rid of some MARKCACHED calls I thought better of. Make sure d_reclen
is aligned for off_t access, or things will break on the Alpha.
 1.82  12-Oct-1997  fvdl Do negative lookup caching. Use a timestamp of the oldest negative cache
entry, so it can be checked against directory modification time for
validity.
 1.81  10-Oct-1997  fvdl * 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.80  17-Jul-1997  fvdl branches: 1.80.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.79  14-Jul-1997  fvdl Don't assume that pointers into mbuf data remain valid across nfsm_dissect.
In readdirplus, don't keep such pointers but store the file attributes
in a variable instead until they are needed. Change nfsm_loadattr*
a bit so it can accept a direct pointer to an nfs_fattr structure.
 1.78  04-Jul-1997  drochner Don't cast 64bit (off_t) file sizes to vm_offset_t (32bit on many
architectures), truncate them intelligently instead.
The truncation is done centralized in vnode_pager.c.
This prevents from wrap-over effects when parts of large (>2^32 byte) files
are mmapped.
Don't allow to mmap above the numerical range of vm_offset_t.
This is considered a temporary solution until the vm system handles the
object sizes/offsets more cleanly.
 1.77  30-Jun-1997  fvdl Immediately return EPERM for a VOP_REMOVE on a directory.
 1.76  12-May-1997  fvdl clear B_AGE for non-flush writes, buffers seem to be reused
too quickly, disturbing NFS performance (XXXX needs further analysis
and a _real_ fix)
 1.75  08-May-1997  mycroft Need stat.h.
 1.74  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.73  08-May-1997  mycroft VEXEC -> VLOOKUP, as appropriate.
 1.72  05-Mar-1997  mycroft In nfs_link(), check for a cross-device mount *before* looking in the
v_data field.
 1.71  22-Feb-1997  fvdl Fixes from BSDI (thanks go to Keith Bostic). Original RCS messages:

date: 1996/07/23 17:14:46; author: donn; state: Exp; lines: +6 -4
Be sure to push out the last page of the file before truncating it.

date: 1996/10/14 22:41:20; author: donn; state: Exp; lines: +2 -2
From Chris: Nfs_link() called vput() on the wrong vnode when aborting
from a cross-device link, which could (and did) lead to crashes.

date: 1996/10/24 16:43:43; author: pjd; state: Exp; lines: +6 -2
Return EOPNOTSUPP when trying to do a setattr with flags.

===

Also (from BSDI too, but the RCS message did not quite describe the change
to this particular file well): move the EROFS a bit further down to
let VOP_ACCESS do it's work and return an 'expected' error value to
a possible layered filesystem.
 1.70  09-Feb-1997  fvdl * Fix some bugs in NQNFS (malformed RPC requests, no directory lease eviction)
* Avoid possible NULL ptr ref in nfs_reply
* Don't ever try to sillyrename directories (from FreeBSD)
 1.69  02-Dec-1996  thorpej branches: 1.69.4;
NFS performance improvement from Doug Rabson/FreeBSD:

Improve the queuing algorithms used by NFS' asynchronous i/o. The
existing mechanism uses a global queue for some buffers and the
vp->b_dirtyblkhd queue for others. This turns sequential writes into
randomly ordered writes to the server, affecting both read and write
performance. The existing mechanism also copes badly with hung
servers, tending to block accesses to other servers when all the iods
are waiting for a hung server.

The new mechanism uses a queue for each mount point. All asynchronous
i/o goes through this queue which preserves the ordering of requests.
A simple mechanism ensures that the iods are shared out fairly between
active mount points.

Reviewed/integrated/approved by Frank van der Linden <fvdl@netbsd.org>
 1.68  25-Oct-1996  cgd make the namei struct members ni_dirp and ni_next, and the componentname
struct member cn_nameptr 'const', since they should never be used to
modify the path name. (Only the pathname buffer, cn_pnbuf, should be
modified.) Propagate the const poisoning to code that uses the namei
and componentname structs.
 1.67  13-Oct-1996  christos revert kprintf changes
 1.66  10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.65  07-Sep-1996  mycroft Implement poll(2).
 1.64  01-Sep-1996  mycroft Add a set of generic file system operations that most file systems use.
Also, fix some time stamp bogosities.
 1.63  07-Jul-1996  fvdl Use the right time for v3 setattr operation.
 1.62  11-May-1996  mycroft branches: 1.62.4;
Change VOP_UPDATE() semantics:
* Make 2nd and 3rd args timespecs, not timevals.
* Consistently pass a Boolean as the 4th arg (except in LFS).
Also, fix ffs_update() and lfs_update() to actually change the nsec fields.
 1.61  03-Apr-1996  thorpej Make these link in the absense of "options FIFO".
 1.60  05-Mar-1996  jtk fix panic "leaf should be empty" on diagnostic kernels when unlinking on
a read-only file system.
 1.59  18-Feb-1996  fvdl Bring in a merge of Rick Macklem's NFSv3 code from Lite2
 1.58  09-Feb-1996  christos nfs prototype changes
 1.57  09-Feb-1996  mycroft Fix vop_link, vop_symlink, and vop_remove semantics in several ways:
* Change the argument names to vop_link so they actually make sense.
* Implement vop_link and vop_symlink for all file systems, so they do proper
cleanup.
* Require the file system to decide whether or not linking and unlinking of
directories is allowed, and disable it for all current file systems.
 1.56  01-Feb-1996  jtc Rename struct timespec fields to conform to POSIX.1b
 1.55  31-Jan-1996  mycroft Don't specify a uid or gid in create operations; let the server fill it in.
 1.54  31-Jan-1996  mycroft Correct some uses of -1 and VNOVAL.
 1.53  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.52  14-Oct-1995  ghudson Add cookie support. Stash cookies in the word prior to the end of
each entry, and read them out in nfs_readdir().

Caveat: our current caching method for directory blocks uses the
server offset of the first directory entry as an identifier, so a
Linux emulation getdirentries() will wind up retrieving one block from
the NFS server for each directory entry, unnecessarily thrashing the
cache. The situation isn't as bad for other emulations.

Instead of getblk(), we need to write a routine to scan each cache
block associated with vp to find a cookie that matches at some
directory entry. Some later time.
 1.51  09-Oct-1995  mycroft branches: 1.51.2;
For now, return EINVAL if the client needs cookies.
 1.50  18-Mar-1995  gwr Initialize fields in the RPC data where we were sending garbage.
 1.49  10-Jan-1995  mycroft Make sure readdir requests are only truncated on block boundaries.
 1.48  29-Dec-1994  mycroft Minor consistency nits.
 1.47  29-Dec-1994  mycroft Remove a bit of redundant code.
 1.46  27-Dec-1994  mycroft Format police.
 1.45  27-Dec-1994  mycroft Fix typos in last change.
 1.44  24-Dec-1994  ws Implement and use a common access checking routine
 1.43  13-Dec-1994  mycroft Turn lease_check() into a vnode op, per CSRG.
 1.42  13-Dec-1994  mycroft Remove an old `#ifdef notyet'.
 1.41  20-Oct-1994  cgd update for new syscall args description mechanism
 1.40  30-Aug-1994  pk mknod() must release its new vnode.
 1.39  21-Aug-1994  mycroft Don't attempt to use IO_APPEND for NQNFS, as suggested by Rick Macklem.
 1.38  13-Aug-1994  pk Files with > 1 links can always be removed on the server, even if a
"silly name" exists.
 1.37  08-Aug-1994  deraadt delete unused extern decl
 1.36  12-Jul-1994  mycroft Bug fix from Rick Macklem for a problem with linking to an open file.
 1.35  03-Jul-1994  mycroft branches: 1.35.2;
Fix problem with O_TRUNC and NFS device nodes.
 1.34  29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.33  22-Jun-1994  pk straighten out diskless swap code somewhat.
 1.32  08-Jun-1994  mycroft Update to 4.4-Lite fs code, with local changes.
 1.31  19-May-1994  cgd stupidity for prototypes...
 1.30  25-Apr-1994  cgd some prototype cleanup, eliminate/replace bogus types (e.g. quad and
u_quad) -> use better types (e.g. quad_t & u_quad_t in inodes),
some cleanup.
 1.29  21-Apr-1994  cgd blow away all vestiges of nfsnode locking.
(1) it's unnecessary
(2) it causes machines to hang (yup!)
(3) it'd be gone in a few days anyway (it'd been yanked out
of 4.4-Lite by macklem long ago)
It was only there because macklem couldn't originally decide if things
should be locked, or not...
 1.28  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.27  14-Apr-1994  pk Remove bogus type translation; in stead, use IFTOVT again to go from
`NFS mode bits' to `vnode type'.
Use aliased vnode consistently.
 1.26  27-Mar-1994  cgd expand uid_t/gid_t/off_t
 1.25  09-Mar-1994  ws Make FFS optional
 1.24  15-Feb-1994  mycroft Macros bite again.
 1.23  15-Feb-1994  mycroft Format police.
 1.22  15-Feb-1994  pk Update {a,m}time vnode attributes on special files a la ufs_vnode.c,
but make it a non-urgent operation, to leave us some performance.
 1.21  06-Feb-1994  mycroft Eliminate some more uses of b_actl.
 1.20  10-Jan-1994  pk reparations...
 1.19  10-Jan-1994  pk Don't deny unlink()s of files with the "silly" bit on, but still have > 1 links,
but avoid doing gratuitous (possibly expensive) get_attr() calls.
 1.18  04-Jan-1994  cgd add support for union and loopback mounts, from jsp
 1.17  22-Dec-1993  cgd fix nfs_print, add cross-device link checking (From jsp)
 1.16  18-Dec-1993  mycroft Canonicalize all #includes.
 1.15  16-Dec-1993  pk Avoid dereferencing NULL pointer in nfs_doio() when B_PHYS is on.
Remove comment talking about nfsiomaps that we don't have.
Always use credentials that are in the buffer header, in stead of trying
to get them from pageproc, which may once have been necessary to push pages
to swap (cannot imaging anyone having exercised this over NFS though).
 1.14  07-Dec-1993  cgd fix a goof that i made; return *before* nfs_lock() is called...
 1.13  20-Nov-1993  cgd do something better with lookup return values; suggested by BSDI's msdosfs mod
 1.12  12-Nov-1993  cgd new specfs.h and fifo.h locations
 1.11  07-Sep-1993  ws branches: 1.11.2;
Changes to VFS readdir semantics
NFS changes for better cookie support
ISOFS changes for better Rockridge support and support for generation numbers
 1.10  02-Aug-1993  mycroft Make return type of nfs_print be a void, not an int.
 1.9  13-Jul-1993  cgd get rid of some more bogus changes from a week ago
 1.8  13-Jul-1993  cgd diskless changes made last time were hosed; were using NULL for
"no credentials" rather than NOCRED.
 1.7  07-Jul-1993  cgd changes from ws to support diskless booting... these are "OK" on inspection
and after testing... (actually, currently, none of the changed
code is even used...)
 1.6  03-Jun-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...)
 1.5  22-May-1993  cgd add Yuval Yarom's changes (originally for BSD/386) for advisory record
locking on NFS files. Note that this DOES NOT support network locking,
only local advisory locks.
 1.4  21-May-1993  cgd add rcsid again; fix RCS+crash fuckup
 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.11.2.5  07-Dec-1993  cgd update from trunk
 1.11.2.4  20-Nov-1993  cgd do something better with lookup return values; suggested by BSDI's msdosfs mod
 1.11.2.3  12-Nov-1993  cgd new specfs.h and fifo.h locations, and include file syntax updates
 1.11.2.2  16-Oct-1993  mycroft Nuke #ifndef hp300 & i386 block of variable definitions that were never used.
 1.11.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.35.2.4  06-Oct-1994  mycroft Update from trunk.
 1.35.2.3  21-Aug-1994  mycroft update from trunk
 1.35.2.2  09-Aug-1994  mycroft update from trunk
 1.35.2.1  12-Jul-1994  cgd linking to open file fix, from trunk.
 1.51.2.2  02-Feb-1996  mycroft Bring in changes for mondo patch 2.
 1.51.2.1  17-Oct-1995  ghudson Update from main branch to get cookie support into the NFS readdir
vnode operation.
 1.62.4.3  05-Mar-1997  mycroft Pull up nfs_link() fix.
 1.62.4.2  04-Mar-1997  mycroft Pull up bug fixes from -current, per fvdl.
 1.62.4.1  08-Jul-1996  jtc Pulled up from rev 1.63 by request from Frank van der Linden
 1.69.4.1  12-Mar-1997  is Merge in changes from Trunk
 1.80.2.1  14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.97.2.1  09-Nov-1998  chs initial snapshot. lots left to do.
 1.100.6.1  30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code). Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
 1.100.4.5  02-Aug-1999  thorpej Update from trunk.
 1.100.4.4  11-Jul-1999  chs remove uvm_vnp_uncache(), it's no longer needed.
 1.100.4.3  04-Jul-1999  chs support VOP_BALLOC().
 1.100.4.2  21-Jun-1999  thorpej Sync w/ -current.
 1.100.4.1  07-Jun-1999  chs merge everything from chs-ubc branch.
 1.100.2.3  15-Aug-2000  he Apply patch (requested by fvdl):
Be careful about data consistency across operations which may
block. Should fix some reported nfs_lookup panics.
 1.100.2.2  05-Jan-2000  he Pull up revision 1.108 (via patch, requested by fvdl):
Insert an extra VOP_ACCESS check in nfs_lookup, preventing cached
access mishaps for lookup and getattr. Fixes PR#8884.
 1.100.2.1  22-Jun-1999  perry pullup 1.100->1.101 (fvdl): fix file creation with a Solaris 7 server
 1.106.8.2  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.106.8.1  21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

Runs on i386, needs work on other arch's. Main kernel routines should be
fine, but a number of the stand programs need help.

cd, fd, ccd, wd, and sd have been updated. sd has been tested with non-512
byte block devices. vnd, raidframe, and lfs need work.

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.106.4.1  19-Oct-1999  fvdl Bring in Kirk McKusick's FFS softdep code on a branch.
 1.106.2.6  23-Apr-2001  bouyer Sync with HEAD.
 1.106.2.5  11-Feb-2001  bouyer Sync with HEAD.
 1.106.2.4  13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.106.2.3  08-Dec-2000  bouyer Sync with HEAD.
 1.106.2.2  22-Nov-2000  bouyer Sync with HEAD.
 1.106.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.113.4.4  29-Jan-2002  he Pull up revision 1.148 (requested by fvdl):
Set np->n_size before calling nfs_vinvalbuf. Avoids confusion as
to the actual file size.
 1.113.4.3  14-Dec-2000  he Pull up revisions 1.120,1.123 (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.113.4.2  19-Sep-2000  fvdl Revision 1.118:
Fix bug in access cache that might result in permission being denied
needlessly. From Matthias Drochner.
(approved by thorpej)
 1.113.4.1  30-Jul-2000  jdolecek Pullup from trunk (approved by thorpej):
Change lf_advlock() to:
int lf_advlock (struct vop_advlock_args *, struct lockf **, off_t)

This matches it's usage. Change inspired by FreeBSD, though we use
off_t instead u_quad_t as the last argument.

sys/lockf.h rev. 1.9
msdosfs/msdosfs_vnops.c rev. 1.99
kern/vfs_lockf.c rev. 1.17
miscfs/specfs/spec_vnops.c rev. 1.49
nfs/nfs_vnops.c rev. 1.115
ufs/ext2fs/ext2fs_vnops.c rev. 1.28
ufs/ufs/ufs_vnops.c rev. 1.72
 1.130.2.17  11-Dec-2002  thorpej Sync with HEAD.
 1.130.2.16  11-Nov-2002  nathanw Catch up to -current
 1.130.2.15  22-Oct-2002  thorpej Sync with HEAD.
 1.130.2.14  18-Oct-2002  thorpej Sync with HEAD.
 1.130.2.13  15-Jul-2002  nathanw Whitespace.
 1.130.2.12  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.130.2.11  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.130.2.10  20-Jun-2002  nathanw Catch up to -current.
 1.130.2.9  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.130.2.8  08-Jan-2002  nathanw Catch up to -current.
 1.130.2.7  14-Nov-2001  nathanw Catch up to -current.
 1.130.2.6  22-Oct-2001  nathanw Catch up to -current.
 1.130.2.5  26-Sep-2001  nathanw Catch up to -current.
Again.
 1.130.2.4  21-Sep-2001  nathanw Catch up to -current.
 1.130.2.3  24-Aug-2001  nathanw Catch up with -current.
 1.130.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.130.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.134.2.8  30-Sep-2002  jdolecek add support for kevents to NFS
to detect file changes on server by other NFS clients, polling kernel thread
is used to periodically check for attribute changes of watched files;
the NFS server is only contacted when the vnode expires from local attrcache
(which takes 5-60 seconds currently), to keep network&CPU overhead low

the routine checking for remote changes is quite simplistic, but hopefully
doing it's job well enough
 1.134.2.7  23-Sep-2002  jdolecek add spec kqfilter vnode op
 1.134.2.6  22-Sep-2002  jdolecek add fifo_kqfilter() to fifo ops, to switch on support for kevents
 1.134.2.5  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.134.2.4  16-Mar-2002  jdolecek Catch up with -current.
 1.134.2.3  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.134.2.2  25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.134.2.1  03-Aug-2001  lukem update to -current
 1.137.2.2  01-Oct-2001  fvdl Catch up with -current.
 1.137.2.1  18-Sep-2001  fvdl Various changes to make cloning devices possible:

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

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

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


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

Light to moderate testing done an i386 system (arch doesn't matter
though, these are MI changes).
 1.141.2.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.150.2.1  30-May-2002  gehenna Catch up with -current.
 1.151.2.1  18-Oct-2002  thorpej Pullup revision 1.152. Original log message:

nfs_remove(): Don't vput() the vnode twice if vp == dvp, vrele() and
vput() instead.
 1.175.2.12  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.175.2.11  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.175.2.10  04-Feb-2005  skrll Sync with HEAD.
 1.175.2.9  24-Jan-2005  skrll Sync with HEAD.
 1.175.2.8  17-Jan-2005  skrll Sync with HEAD.
 1.175.2.7  18-Dec-2004  skrll Sync with HEAD.
 1.175.2.6  19-Oct-2004  skrll Sync with HEAD
 1.175.2.5  24-Sep-2004  skrll Sync with HEAD.
 1.175.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.175.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.175.2.2  03-Aug-2004  skrll Sync with HEAD
 1.175.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.186.2.10  16-Mar-2005  tron Pull up revision 1.219 (requested by yamt in ticket #1208):
nfs_readdirrpc, nfs_readdirplusrpc:
avoid infinite loops when getting readdir response without
any entries or eof. PR/28971.
 1.186.2.9  16-Mar-2005  tron Pull up revision 1.206 (requested by yamt in ticket #1134):
nfs_commit: use NAC_NOTRUNC when loading an attribute
as we're called holding pages locked.
 1.186.2.8  11-Jan-2005  jmc Pullup patch (requested by yamy in ticket #1078)

Don't do kludge for a reply to a retransmitted request
unless we actually retransmitted the request.
 1.186.2.7  11-Jan-2005  jmc Pullup patch (requested by yamt in ticket #1077)

nfs_lookup: check n_nctime for positive entries as well to improve
cache consistency.
 1.186.2.6  10-Jul-2004  tron branches: 1.186.2.6.2;
Pull up revision 1.204 via patch (requested by yamt in ticket #636):
nfs_create: after an exclusive create rpc, make sure to update
timestamps, which were likely used to store the verifier.
reported by Mark Davies. PR/26200
 1.186.2.5  10-Jul-2004  tron Pull up revision 1.191 (requested by tls in ticket #634):
nfs_readdirplusrpc: fix a deadlock problem.
don't wait for vnode lock to load attributes.
otherwise, because READDIRPLUS returns DOTDOT entry as well,
we violate locking order.
 1.186.2.4  10-Jul-2004  tron Pull up revision 1.190 (requested by tls in ticket #634):
don't issue VOP_GETATTR blindly in nfs_nget().
in many cases, GETATTR RPCs here is redundant because the caller has
postop_attr. instead, make sure the resulted vnode have a valid
attribute in nfs_lookup().
 1.186.2.3  10-Jul-2004  tron Pull up revision 1.189 (requested by tls in ticket #634):
nfs_readdirplusrpc: purge existing namecache entry before entering a new one.
otherwise we'll get duplicated entries.
 1.186.2.2  10-Jul-2004  tron Pull up revision 1.188 (requested by tls in ticket #634):
when entering a namecache entry for nfs, ensure to update the appropriate
timestamp in the nfsnode so that we don't get namecache-miss when
looking up the node we just created.
 1.186.2.1  10-Jul-2004  tron Pull up revision 1.187 (requested by tls in ticket #634):
avoid unnecessary namecache purges in some places.
 1.186.2.6.2.5  27-Oct-2005  riz Pull up following revision(s) (requested by christos in ticket #5863):
sys/nfs/nfs_subs.c: revision 1.152 via patch
sys/nfs/nfs.h: revision 1.49
sys/nfs/nfs_vfsops.c: revision 1.149 via patch
usr.sbin/amd/include/config.h: revision 1.36
sys/nfs/nfs_vnops.c: revision 1.227 via patch
sys/nfs/nfsmount.h: revision 1.34
Allow the attribute cache to be turned off, and allow amd to do it.
 1.186.2.6.2.4  16-Mar-2005  tron Pull up revision 1.219 (requested by yamt in ticket #1208):
nfs_readdirrpc, nfs_readdirplusrpc:
avoid infinite loops when getting readdir response without
any entries or eof. PR/28971.
 1.186.2.6.2.3  16-Mar-2005  tron Pull up revision 1.206 (requested by yamt in ticket #1134):
nfs_commit: use NAC_NOTRUNC when loading an attribute
as we're called holding pages locked.
 1.186.2.6.2.2  11-Jan-2005  jmc Pullup patch (requested by yamy in ticket #1078)

Don't do kludge for a reply to a retransmitted request
unless we actually retransmitted the request.
 1.186.2.6.2.1  11-Jan-2005  jmc Pullup patch (requested by yamt in ticket #1077)

nfs_lookup: check n_nctime for positive entries as well to improve
cache consistency.
 1.215.2.1  29-Apr-2005  kent sync with -current
 1.217.2.2  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.217.2.1  12-Feb-2005  yamt sync with head.
 1.220.2.2  16-Jul-2006  ghen Pull up following revision(s) (requested by jld in ticket #1424):
sys/nfs/nfs_vnops.c: revision 1.240 via patch
sys/nfs/nfs_var.h: revision 1.62 via patch
Fix race condition in NFS renaming that could cause the renamed file to be
deleted (PR/33861).
 1.220.2.1  27-Sep-2005  tron branches: 1.220.2.1.2;
Pull up following revision(s) (requested by christos in ticket #816):
sys/nfs/nfs_vfsops.c: revision 1.149
sys/nfs/nfs_vnops.c: revision 1.227
ATTRTIMEO takes 2 args.
 1.220.2.1.2.1  16-Jul-2006  ghen Pull up following revision(s) (requested by jld in ticket #1424):
sys/nfs/nfs_vnops.c: revision 1.240 via patch
sys/nfs/nfs_var.h: revision 1.62 via patch
Fix race condition in NFS renaming that could cause the renamed file to be
deleted (PR/33861).
 1.222.2.11  27-Feb-2008  yamt revert incomplete nfs client locking for now.
 1.222.2.10  27-Feb-2008  yamt sync with head.
 1.222.2.9  15-Feb-2008  yamt - sprinkle some locks.
- disable MNT_UPDATE because it involves too much locking headache.
- don't overwrite other bits in v_vflags when setting VV_ROOT.
 1.222.2.8  04-Feb-2008  yamt sync with head.
 1.222.2.7  21-Jan-2008  yamt sync with head
 1.222.2.6  07-Dec-2007  yamt sync with head
 1.222.2.5  15-Nov-2007  yamt sync with head.
 1.222.2.4  03-Sep-2007  yamt sync with head.
 1.222.2.3  26-Feb-2007  yamt sync with head.
 1.222.2.2  30-Dec-2006  yamt sync with head.
 1.222.2.1  21-Jun-2006  yamt sync with head.
 1.227.2.1  20-Oct-2005  yamt adapt nfs.
 1.229.2.3  22-Nov-2005  yamt remove a whitespace change which is not related to this branch.
 1.229.2.2  18-Nov-2005  yamt - associate read-ahead context to vnode, rather than file.
- revert VOP_READ prototype.
 1.229.2.1  15-Nov-2005  yamt adapt ffs, lfs, nfs.
 1.230.6.3  01-Jun-2006  kardel Sync with head.
 1.230.6.2  22-Apr-2006  simonb Sync with head.
 1.230.6.1  04-Feb-2006  simonb Adapt for timecounters: mostly use get*time() and use "time_second"
instead of "time.tv_sec".
 1.230.4.1  09-Sep-2006  rpaulo sync with head
 1.230.2.2  15-Jan-2006  yamt rename VMSPACE_IS_KERNEL to VMSPACE_IS_KERNEL_P. ("predicate")
suggested by Matt Thomas.
 1.230.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.231.6.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.231.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.231.4.2  19-Apr-2006  elad sync with head.
 1.231.4.1  08-Mar-2006  elad Adapt to kernel authorization KPI.

This could use some testing...
 1.231.2.3  11-Aug-2006  yamt sync with head
 1.231.2.2  26-Jun-2006  yamt sync with head.
 1.231.2.1  24-May-2006  yamt sync with head.
 1.236.2.1  19-Jun-2006  chap Sync with head.
 1.237.2.1  13-Jul-2006  gdamore Merge from HEAD.
 1.241.6.2  10-Dec-2006  yamt sync with head.
 1.241.6.1  22-Oct-2006  yamt sync with head
 1.241.4.3  01-Feb-2007  ad Sync with head.
 1.241.4.2  12-Jan-2007  ad Sync with head.
 1.241.4.1  18-Nov-2006  ad Sync with head.
 1.245.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.249.2.3  07-May-2007  yamt sync with head.
 1.249.2.2  12-Mar-2007  rmind Sync with HEAD.
 1.249.2.1  28-Feb-2007  yamt sync with head. (somehow missed in the previous)
 1.252.4.1  11-Jul-2007  mjf Sync with head.
 1.252.2.4  01-Sep-2007  ad Update for pool_cache API changes.
 1.252.2.3  08-Jun-2007  ad Sync with head.
 1.252.2.2  05-Apr-2007  ad Compile fixes.
 1.252.2.1  13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.256.12.1  13-Nov-2007  bouyer Sync with HEAD
 1.256.8.4  23-Mar-2008  matt sync with HEAD
 1.256.8.3  09-Jan-2008  matt sync with HEAD
 1.256.8.2  08-Nov-2007  matt sync with -HEAD
 1.256.8.1  06-Nov-2007  matt sync with HEAD
 1.256.6.5  09-Dec-2007  jmcneill Sync with HEAD.
 1.256.6.4  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.256.6.3  14-Nov-2007  joerg Sync with HEAD.
 1.256.6.2  11-Nov-2007  joerg Sync with HEAD.
 1.256.6.1  29-Oct-2007  joerg Sync with HEAD.
 1.257.2.4  18-Feb-2008  mjf Sync with HEAD.
 1.257.2.3  27-Dec-2007  mjf Sync with HEAD.
 1.257.2.2  08-Dec-2007  mjf Sync with HEAD.
 1.257.2.1  19-Nov-2007  mjf Sync with HEAD.
 1.260.2.2  26-Dec-2007  ad Sync with head.
 1.260.2.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.261.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.266.16.2  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.266.16.1  19-Oct-2008  haad Sync with HEAD.
 1.266.10.9  10-Oct-2010  yamt some locking changes
 1.266.10.8  26-Sep-2010  yamt locking changes
 1.266.10.7  11-Aug-2010  yamt sync with head.
 1.266.10.6  11-Mar-2010  yamt sync with head
 1.266.10.5  18-Jul-2009  yamt sync with head.
 1.266.10.4  24-Jun-2009  yamt lock vnode when calling VOP_GETATTR because there's no reasonable way for
an implementation of VOP_GETATTR to prevent the vnode from being revoked.
 1.266.10.3  16-May-2009  yamt sync with head
 1.266.10.2  04-May-2009  yamt sync with head.
 1.266.10.1  27-Apr-2008  yamt commit some work-in-progress changes to make nfs client mp-safe to a branch,
so that they won't get lost.
- sprinkle some locking
- mark the filesystem, nfstimer callout, and kq kthread mp-safe
- add assertions and comments
- disable upgrade mount for now
- some unrelated cosmetic changes
 1.266.6.1  17-Jan-2009  mjf Sync with HEAD.
 1.267.2.2  28-Apr-2009  skrll Sync with HEAD.
 1.267.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.268.4.2  29-Dec-2008  christos fix printf format.
 1.268.4.1  19-Nov-2008  christos file nfs_vnops.c was added on branch christos-time_t on 2008-12-29 00:14:38 +0000
 1.269.2.2  23-Jul-2009  jym Sync with HEAD.
 1.269.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.282.4.5  31-May-2011  rmind sync with head
 1.282.4.4  05-Mar-2011  rmind sync with head
 1.282.4.3  03-Jul-2010  rmind sync with head
 1.282.4.2  30-May-2010  rmind sync with head
 1.282.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.282.2.3  06-Nov-2010  uebayasi Sync with HEAD.
 1.282.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.282.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.289.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.290.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.292.2.5  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.292.2.4  16-Jan-2013  yamt sync with (a bit old) head
 1.292.2.3  30-Oct-2012  yamt sync with head
 1.292.2.2  23-May-2012  yamt sync with head.
 1.292.2.1  17-Apr-2012  yamt sync with head
 1.293.4.2  14-Jul-2016  snj Pull up following revision(s) (requested by hannken in ticket #1363):
sys/nfs/nfs_vnops.c: revision 1.309
Return an error if NFSPROC_LOOKUP returns the file handle of the current
directory. Treating it as DOT lookup would put garbage into the name
cache and could panic on future lookups.
Seen with ZFS file system exported from OmniOS, an OpenSolaris derivative.
Fixes PR kern/50664 "cd .." over NFS/ZFS can panic kernel
 1.293.4.1  12-Aug-2012  martin branches: 1.293.4.1.4; 1.293.4.1.6;
Pull up following revision(s) (requested by manu in ticket #484):
sys/fs/nilfs/nilfs_vnops.c: revision 1.18
sys/ufs/ufs/ufs_lookup.c: revision 1.117
sys/nfs/nfs_vnops.c: revision 1.295
sys/ufs/chfs/chfs_vnops.c: revision 1.8
sys/ufs/ext2fs/ext2fs_lookup.c: revision 1.70
sys/fs/unionfs/unionfs_vnops.c: revision 1.6
sys/kern/vfs_cache.c: revision 1.89
sys/fs/efs/efs_vnops.c: revision 1.26
sys/fs/hfs/hfs_vnops.c: revision 1.26
sys/fs/adosfs/adlookup.c: revision 1.16
sys/fs/puffs/puffs_vnops.c: revision 1.168
sys/fs/tmpfs/tmpfs_vnops.c: revision 1.98
sys/fs/ntfs/ntfs_vnops.c: revision 1.52
sys/fs/cd9660/cd9660_lookup.c: revision 1.20
sys/fs/msdosfs/msdosfs_lookup.c: revision 1.24
sys/fs/smbfs/smbfs_vnops.c: revision 1.80
sys/fs/udf/udf_vnops.c: revision 1.72
sys/fs/filecorefs/filecore_lookup.c: revision 1.14
sys/fs/puffs/puffs_node.c: revision 1.25
Move some the test for MAKEENTRY into the cache_enter(9). Make some
variables in vfs_cache.c static, __read_mostly, etc.
No objection on tech-kern@.
 1.293.4.1.6.1  14-Jul-2016  snj Pull up following revision(s) (requested by hannken in ticket #1363):
sys/nfs/nfs_vnops.c: revision 1.309
Return an error if NFSPROC_LOOKUP returns the file handle of the current
directory. Treating it as DOT lookup would put garbage into the name
cache and could panic on future lookups.
Seen with ZFS file system exported from OmniOS, an OpenSolaris derivative.
Fixes PR kern/50664 "cd .." over NFS/ZFS can panic kernel
 1.293.4.1.4.1  14-Jul-2016  snj Pull up following revision(s) (requested by hannken in ticket #1363):
sys/nfs/nfs_vnops.c: revision 1.309
Return an error if NFSPROC_LOOKUP returns the file handle of the current
directory. Treating it as DOT lookup would put garbage into the name
cache and could panic on future lookups.
Seen with ZFS file system exported from OmniOS, an OpenSolaris derivative.
Fixes PR kern/50664 "cd .." over NFS/ZFS can panic kernel
 1.293.2.1  29-Apr-2012  mrg sync to latest -current.
 1.295.2.4  03-Dec-2017  jdolecek update from HEAD
 1.295.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.295.2.2  23-Jun-2013  tls resync from head
 1.295.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.299.6.1  18-May-2014  rmind sync with head
 1.304.2.1  10-Aug-2014  tls Rebase.
 1.306.4.3  28-Aug-2017  skrll Sync with HEAD
 1.306.4.2  19-Mar-2016  skrll Sync with HEAD
 1.306.4.1  06-Jun-2015  skrll Sync with HEAD
 1.306.2.2  06-Feb-2016  snj Pull up following revision(s) (requested by hannken in ticket #1094):
sys/nfs/nfs_vnops.c: revision 1.309
Return an error if NFSPROC_LOOKUP returns the file handle of the current
directory. Treating it as DOT lookup would put garbage into the name
cache and could panic on future lookups.
Seen with ZFS file system exported from OmniOS, an OpenSolaris derivative.
Fixes PR kern/50664 "cd .." over NFS/ZFS can panic kernel
 1.306.2.1  19-May-2015  snj branches: 1.306.2.1.2;
Pull up following revision(s) (requested by chs in ticket #769):
sys/nfs/nfs_vnops.c: revision 1.308
in nfs_writerpc(), avoid a signed/unsigned problem in computing the
number of bytes to back up in the uio when we need to resend a write RPC
(eg. after a server crash) on a 64-bit platform. should fix PR 35448.
 1.306.2.1.2.1  06-Feb-2016  snj Pull up following revision(s) (requested by hannken in ticket #1094):
sys/nfs/nfs_vnops.c: revision 1.309
Return an error if NFSPROC_LOOKUP returns the file handle of the current
directory. Treating it as DOT lookup would put garbage into the name
cache and could panic on future lookups.
Seen with ZFS file system exported from OmniOS, an OpenSolaris derivative.
Fixes PR kern/50664 "cd .." over NFS/ZFS can panic kernel
 1.310.12.4  21-Apr-2020  martin Sync with HEAD
 1.310.12.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.310.12.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.310.12.1  10-Jun-2019  christos Sync with HEAD
 1.310.10.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.310.4.1  12-Dec-2023  martin Pull up following revision(s) (requested by schmonz in ticket #1927):

sys/nfs/nfs_vnops.c: revision 1.325

NFS client: fix interop with macOS 14 servers.

Symptom: a bunch of "Cannot open `.' (Invalid argument)".
thorpej@ analysis and fix: on the first request to read a given
directory, make sure READDIR and READDIRPLUS cookie verifiers are
being set to 0. This is in RFC1813 and macOS must have gotten
stricter about it.

Verified on 10.0_RC1/aarch64 to fix the reproducers in PR kern/57691 as
well as the original use case in which I met the bug: pkg_rr once again
runs to completion.
 1.311.4.1  11-Dec-2023  martin Pull up following revision(s) (requested by schmonz in ticket #1778):

sys/nfs/nfs_vnops.c: revision 1.325

NFS client: fix interop with macOS 14 servers.

Symptom: a bunch of "Cannot open `.' (Invalid argument)".
thorpej@ analysis and fix: on the first request to read a given
directory, make sure READDIR and READDIRPLUS cookie verifiers are
being set to 0. This is in RFC1813 and macOS must have gotten
stricter about it.

Verified on 10.0_RC1/aarch64 to fix the reproducers in PR kern/57691 as
well as the original use case in which I met the bug: pkg_rr once again
runs to completion.
 1.312.2.1  29-Feb-2020  ad Sync with head.
 1.313.4.1  20-Apr-2020  bouyer Sync with HEAD
 1.317.6.1  01-Aug-2021  thorpej Sync with HEAD.
 1.324.4.1  11-Dec-2023  martin Pull up following revision(s) (requested by schmonz in ticket #490):

sys/nfs/nfs_vnops.c: revision 1.325

NFS client: fix interop with macOS 14 servers.

Symptom: a bunch of "Cannot open `.' (Invalid argument)".
thorpej@ analysis and fix: on the first request to read a given
directory, make sure READDIR and READDIRPLUS cookie verifiers are
being set to 0. This is in RFC1813 and macOS must have gotten
stricter about it.

Verified on 10.0_RC1/aarch64 to fix the reproducers in PR kern/57691 as
well as the original use case in which I met the bug: pkg_rr once again
runs to completion.

RSS XML Feed