Home | History | Annotate | Download | only in nfs
History log of /src/sys/nfs/nfs_socket.c
RevisionDateAuthorComments
 1.203  22-Feb-2025  mlelstv Poll for interrupted NFS operations if the waiting process hasn't
issued the operation and then won't get the interrupt signal itself.
 1.202  05-Feb-2024  andvar fix various typos in comments.
 1.201  09-Apr-2023  riastradh nfs: Simplify assertion. No functional change intended.
 1.200  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.199  21-Jan-2018  christos branches: 1.199.2; 1.199.4;
PR/40491: From Tobias Ulmer in tech-kern@:
1. Protect the nfs request queue with its own mutex
2. make the nfs_receive queue check for signals so that intr mounts
can be interrupted.
XXX: pullup-8
 1.198  17-Jun-2016  christos branches: 1.198.10;
Serialize all access to the NFS request queue via splsoftnet(). Fixes random
crashes.
XXX: Pullup-7
 1.197  15-Jul-2015  manu Fix soft NFS force unmount

For many reasons, forcibly unmounting a soft NFS mount could hang forever.
Here are the fixes:
- Introduce decents timeouts in operation that awaited NFS server reply.
- On timeout, fails operations on soft mounts with EIO.
- Introduce NFSMNT_DISMNTFORCE to let the filesystem know that a
force unmount is ongoing. This causes timeouts to be reduced and
prevents the NFS client to attempt reconnecting to the NFS server.

Also fix a race condition where some asynchronous I/O could reference
destroyed mount structures. We fix this by awaiting asynchronous I/O
to drain before proceeding.

Reviewed by Chuck Silvers.
 1.196  09-May-2015  rtr change sosend() to accept sockaddr * instead of mbuf * for nam.

bump to 7.99.16
 1.195  02-May-2015  rtr make connect syscall use sockaddr_big and modify pr_{send,connect}
nam parameter type from buf * to sockaddr *.

final commit for parameter type changes to protocol user requests

* bump kernel version to 7.99.15 for parameter type changes to pr_{send,connect}
 1.194  03-Apr-2015  rtr * change pr_bind to accept struct sockaddr * instead of struct mbuf *
* update protocol bind implementations to use/expect sockaddr *
instead of mbuf *
* introduce sockaddr_big struct for storage of addr data passed via
sys_bind; sockaddr_big is of sufficient size and alignment to
accommodate all addr data sizes received.
* modify sys_bind to allocate sockaddr_big instead of using an mbuf.
* bump kernel version to 7.99.9 for change to pr_bind() parameter type.

Patch posted to tech-net@
http://mail-index.netbsd.org/tech-net/2015/03/15/msg005004.html

The choice to use a new structure sockaddr_big has been retained since
changing sockaddr_storage size would lead to unnecessary ABI change. The
use of the new structure does not preclude future work that increases
the size of sockaddr_storage and at that time sockaddr_big may be
trivially replaced.

Tested by mrg@ and myself, discussed with rmind@, posted to tech-net@
 1.193  05-Sep-2014  matt branches: 1.193.2;
Don't use catch as a variable name.
 1.192  05-Aug-2014  rtr branches: 1.192.2; 1.192.4;
split PRU_SEND function out of pr_generic() usrreq switches and put into
separate functions

xxx_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *, struct lwp *)

- always KASSERT(solocked(so)) even if not implemented

- replace calls to pr_generic() with req = PRU_SEND with calls to
pr_send()

rename existing functions that operate on PCB for consistency (and to
free up their names for xxx_send() PRUs

- l2cap_send() -> l2cap_send_pcb()
- sco_send() -> sco_send_pcb()
- rfcomm_send() -> rfcomm_send_pcb()

patch reviewed by rmind
 1.191  18-May-2014  rmind Add struct pr_usrreqs with a pr_generic function and prepare for the
dismantling of pr_usrreq in the protocols; no functional change intended.
PRU_ATTACH/PRU_DETACH changes will follow soon.

Bump for struct protosw. Welcome to 6.99.62!
 1.190  14-Sep-2013  martin branches: 1.190.2;
Backout wildcard pragma to kill warnings and instead sprinkle a few dozen
__unused attributes.
Requested by joerg@
 1.189  23-Mar-2011  tls branches: 1.189.4; 1.189.14; 1.189.18;
As suggested by matt@: change socket buffer reservations for NFS send/receive
to 3 times max RPC size rather than 2 times. Avoids nasty TCP stalls observed
at Panix. Will require increase to sbmax via sysctl for those running really
huge NFS rsize/wsize (>64K).
 1.188  17-Dec-2010  yamt branches: 1.188.2;
nfs_rcvunlock: don't wake up all waiters.
 1.187  02-Mar-2010  pooka branches: 1.187.2;
Get rid of dependency on fs_nfs.h, i.e. source modules with
conditional content depending on if the NFS client is wanted or
not. The server can now be made an independent module not depending
on the nfs client.

Tested with rump_nfs (standalone client), rump_nfsd (standalone
nfsd) and a qemu installation with both the client and the server.
 1.186  13-Feb-2010  yamt nfs_msg: #if 0 out tprintf for now and comment why.
 1.185  19-Jan-2010  yamt branches: 1.185.2;
nfs_request: fix races which break congestion window and make nfs client stuck.
 1.184  31-Dec-2009  christos appease gcc.
 1.183  06-Dec-2009  dyoung For readability's sake, write NULL instead of (type *)0.
 1.182  05-Nov-2009  bouyer Handle EWOULDBLOCK the same way as EPIPE. It seems the TCP socket layer
can return EWOULDBLOCK on some occasion when the connection is broken.
 1.181  16-Oct-2009  pooka If send fails with EMSGSIZE for whatever reason, it's unlikely to
succeed no matter how hard we retry. So just fail the request.
 1.180  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.179  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.178  04-Feb-2009  ad branches: 1.178.2;
PR kern/40491 5.0: nfs timer can crash/break on smp

Hack around it by acquiring softnet_lock around the client-side timer loop.
 1.177  21-Jan-2009  yamt restore the pre socket locking patch signal behaviour.
this fixes a busy-loop in nfs_connect.
 1.176  18-Jan-2009  mrg Actually enforce the maximum timeout (60s by default) rather
than backing off to 256*SRTT. This is why it sometimes could take
hours for a NFS mount to come back when the server returned.

contributed anonymously.
 1.175  23-Nov-2008  mrg avoid noisy nfs_timer/nfs_reply DEBUG output that occurs when the
NFS server goes away. use ratelimit(9) and only print the console
error once every 10 seconds. PR#31562.
 1.174  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.173  07-Oct-2008  pooka branches: 1.173.2; 1.173.4;
nuke outdated comment
 1.172  30-Sep-2008  pooka Apply #ifdef modern art to make NFSSERVER-without-NFS possible.
 1.171  06-Aug-2008  plunky Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core
 1.170  24-Apr-2008  ad branches: 1.170.2; 1.170.4; 1.170.8;
Merge the socket locking patch:

- Socket layer becomes MP safe.
- Unix protocols become MP safe.
- Allows protocol processing interrupts to safely block on locks.
- Fixes a number of race conditions.

With much feedback from matt@ and plunky@.
 1.169  10-Apr-2008  yamt branches: 1.169.2;
- make nfs_receive and nfs_reply static.
- ansify.
 1.168  28-Mar-2008  yamt whitespace.
 1.167  02-Jan-2008  yamt branches: 1.167.6;
use kmem_alloc instead of malloc.
 1.166  02-Jan-2008  ad Merge vmlocking2 to head.
 1.165  04-Dec-2007  yamt branches: 1.165.4;
merge non-intrusive nfs changes from vmlocking.
 1.164  21-Oct-2007  yamt branches: 1.164.2; 1.164.4;
remove lwp argument from nfs_reconnect and always use &lwp0
because who triggers a reconnect doesn't really matter here. PR/37145.
 1.163  05-Aug-2007  yamt branches: 1.163.2; 1.163.6; 1.163.8;
use kpause rather than lbolt.
 1.162  02-Aug-2007  yamt branches: 1.162.2;
nfsdsock_unlock: add an assertion.
 1.161  27-Jul-2007  yamt stop nfs tick when we have nothing to do.
 1.160  09-Jul-2007  ad branches: 1.160.2;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.159  30-Jun-2007  dsl Updates for changes prototype of kauth_cred_set/getgroups().
 1.158  22-Jun-2007  yamt - nfsrv_slpderef: fix a locking botch.
(should fix "slp->ns_sref == 0" assertion failures in nfsrv_init)
- add some related assertions.
 1.157  01-Jun-2007  yamt use mutex and condvar.
 1.156  01-Jun-2007  yamt nfsdsock_lock: fix an inverted check of SLP_VALID.
 1.155  28-May-2007  yamt - remove nfs_exit exit hook. ok'ed by christos@.
- as far as i understand the code, it shouldn't be necessary
because nfs_request can't return without removing its request
and r->r_lwp is either curlwp or NULL.
- even if it's necessary, leaking requests is not the correct way
to recover from the condition.
- nfs_request: add a related assertion.
 1.154  02-May-2007  yamt nfs_rcvlock: fix NFSMNT_INT check, which has been broken since rev.1.39.
 1.153  02-May-2007  yamt - nfs_reply: keep rcvlock longer so that lwp which already have its reply
received won't be stuck in nfs_receive.
- nfs_rcvlock: check exceptions before sleeping on the lock.
- nfs_rcvunlock: use cv_broadcast rather than cv_signal to ensure that
lwps which received its reply get woken up.
 1.152  30-Apr-2007  yamt remove R_GETONEREP.
 1.151  29-Apr-2007  yamt use condvar.
 1.150  29-Apr-2007  yamt use mutex and condver.
 1.149  12-Mar-2007  ad branches: 1.149.2;
Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
 1.148  04-Mar-2007  christos branches: 1.148.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.147  22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.146  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.145  09-Feb-2007  ad branches: 1.145.2;
Merge newlock2 to head.
 1.144  27-Dec-2006  yamt remove nqnfs.
 1.143  06-Dec-2006  yamt nfs_disconnect: 2 -> SHUT_RDWR. no functional change.
 1.142  06-Dec-2006  yamt nfsrv_rcv: claim ownership of received mbufs.
 1.141  09-Nov-2006  yamt remove some __unused in function parameters.
 1.140  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.139  10-Oct-2006  dogcow change the MOWNER_INIT define to take two args; fix extant struct mowner
decls to use it. Makes options MBUFTRACE compile again and not whinge about
missing structure declarations. (Also makes initialization consistent.)
 1.138  02-Sep-2006  yamt branches: 1.138.2; 1.138.4;
nfsdreq_free: remove an assertion which is not true.
 1.137  15-Jul-2006  yamt nfs_getreq: fix a kauth fallout.
pointed by nanashi-san. http://pc8.2ch.net/test/read.cgi/unix/1145181361/786
 1.136  30-Jun-2006  yamt nfs_request: don't bother to handle NFSERR_STALEWRITEVERF
because it isn't a real nfs error value.
 1.135  07-Jun-2006  kardel branches: 1.135.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.134  28-May-2006  blymn Clean up bogus whitespace
 1.133  28-May-2006  yamt nfs_request: use kauth_cred_free rather than kauth_cred_destroy.
 1.132  19-May-2006  yamt branches: 1.132.2;
- fix compilation problem for !NFSSERVER && NFS.
pointed by Tom Spindler on source-changes@.
- make nfs_srvdesc_pool static.
 1.131  18-May-2006  yamt - fix some leaks in nfsd, introduced by kauth changes.
- simplify code.
- add some assertions.
- wrap some long lines.
- remove an unnecessary ";".
 1.130  14-May-2006  elad integrate kauth.
 1.129  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.128  15-Apr-2006  dogcow #if -> #ifdef
 1.127  15-Apr-2006  christos Coverity CID 734: Define NFS_TEST_HEAVY for testing nfsds, and use this to
ifdef out dead code. XXX: Why is this turned on by default?
 1.126  01-Mar-2006  rpaulo branches: 1.126.2; 1.126.4; 1.126.6;
Back out revision 1.125 and 1.124. The code for checking if
slp->ns_reclen == 0, was already there since "Linux sometimes
generates 0-lenght records.".

Bad Rui...
 1.125  01-Mar-2006  rpaulo In nfsrv_getstream(), ns_reclen will never be negative due to the
previous assignment (recmark & ~0x80000000).
Pointed out by Christos.
 1.124  01-Mar-2006  rpaulo From FreeBSD SA-06:10
Correct a remote kernel panic when processing zero-length RPC records
via TCP.
 1.123  01-Mar-2006  yamt 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.122  03-Jan-2006  yamt branches: 1.122.2; 1.122.4;
nfssvc_nfsd: reduce a chance for a slow peer to capture all our threads.
instead of sleeping to wait for the socket to send our reply,
just hand-off our reply to the thread which is holding the socket.
 1.121  03-Jan-2006  yamt improve nfsd locking.
- don't bother to take nfs_sndlock when doing nfsrv_rcv.
unlike client, we never reconnect.
- nfsrv_getstream: fix the case that m_split sleeps.
- free socket in nfsrv_slpderef rather than nfsrv_zapsock.
fix race with nfssvc_nfsd.
- while i'm here, remove NFSD_WAITING and NFSD_REQINPROG
as they are redundant.
- some comments and assertions.
 1.120  30-Dec-2005  jmmv branches: 1.120.2;
Avoid dereferencing the lwp parameter in nfs_receive, as it is always NULL.
Solves a crash when mounting NFS shares. (The proc parameter used before
the conversion to lwp's was NULL too, so the addition of 'l->l_proc' in the
code was extra.)
 1.119  11-Dec-2005  christos merge ktrace-lwp.
 1.118  21-Nov-2005  yamt use c99 initializers for proct.
 1.117  25-Sep-2005  tron branches: 1.117.6;
Correct typo in last commit to fix compilation error.
 1.116  25-Sep-2005  christos Add missing TIMEDOUT and IO errors.
 1.115  25-Sep-2005  christos Convert from nfs error values to regular errno's. Although most values of
nfs errors are chosen to be the same as errno, some of them are not and
it is better for portability to do the conversion anyway. Also a server
can return a bad error number that can cause the server to crash, because
it can have the high bits that are used internally set. This was the case
with amd. Finally nfs_request() should return a valid errno, because we
can return a bogus value to userland. Thanks to rpaulo for debugging this.
 1.114  29-May-2005  christos branches: 1.114.2;
- sprinkle const
- avoid shadowed variables
- mark bad const use with XXXUNCONST
 1.113  29-Mar-2005  yamt nfsrv_rcv: don't do so_receive from socket upcall context.
while there's little benefits, it complicates locking and confuses
flow control.
 1.112  26-Feb-2005  perry branches: 1.112.2;
nuke trailing whitespace
 1.111  17-Sep-2004  skrll branches: 1.111.4; 1.111.6;
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.110  24-Aug-2004  yamt nfs_request: a workaround for servers doing "maproot".
for i/o requests which are expected not to fail due to permission
to mimic unix file open semantics (READ, WRITE, COMMIT),
try two credentials. namely, the file owner's one and open time one.
remember which credential worked in per-file basis and try it first
next time to minimize number of retries.
ideas from Chuck Silvers. PR/23716 and PR/24987.
 1.109  18-Aug-2004  yamt remove a "proc botch" debug printf. ok'ed by Jonathan Stone.
 1.108  24-Jun-2004  jonathan Rename MBUFTRACE helper function m_claim() to m_claimm(),
for consistency with M_FREE() and m_freem(). Affected files:

sys/mbuf.h
kern/uipc_socket2.c
kern/uipc_mbuf.c
net/if_ethersubr.c
netatalk/ddp_input.c
nfs/nfs_socket.c
 1.107  24-May-2004  jonathan Change DIAGNOSTIC warning in nfs_send() about NULL rep->r_procp: the
warning is triggered pervasively, so print it only once per boot.
(The callers who pass NULL r_procps should soon be fixed to pass a
valid struct proc* ).
 1.106  23-May-2004  yamt - for tcp, use SO_RCVTIMEO to recover from server crash.
otherwise we can be stuck in soreceive forever.
the problem is pointed by Minoura Makoto. PR/25662
- clear r_rexmit on reconnect and clear r_rtt and R_TIMING on retransmit
so that the above (and soft mounts) happy.
 1.105  22-May-2004  jonathan Eliminate several uses of `curproc' from the socket-layer code and from NFS.

Add a new explicit `struct proc *p' argument to socreate(), sosend().
Use that argument instead of curproc. Follow-on changes to pass that
argument to socreate(), sosend(), and (*so->so_send)() calls.
These changes reviewed and independently recoded by Matt Thomas.

Changes to soreceive() and (*dom->dom_exernalize() from Matt Thomas:
pass soreceive()'s struct uio* uio->uio_procp to unp_externalize().
Eliminate curproc from unp_externalize. Also, now soreceive() uses
its uio->uio_procp value, pass that same value downward to
((pr->pru_usrreq)() calls for consistency, instead of (struct proc * )0.

Similar changes in sys/nfs to eliminate (most) uses of curproc,
either via the req-> r_procp field of a struct nfsreq *req argument,
or by passing down new explicit struct proc * arguments.

Reviewed by: Matt Thomas, posted to tech-kern.
NB: The (*pr->pru_usrreq)() change should be tested on more (all!) protocols.
 1.104  10-May-2004  yamt don't do kludge for a reply to a retransmitted request
unless we actually retransmitted the request.
 1.103  21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.102  17-Mar-2004  yamt branches: 1.102.2;
nfs_sndlock: fix nfsd null dereference.
 1.101  10-Mar-2004  matt Don't report EPIPE errors on nfs sockets. These can be due to idle tcp
mounts which will be closed by netapp, solaris, etc. if left idle too long.
 1.100  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.99  09-Oct-2003  yamt for nfs_timer_ch, use callout_schedule rather than callout_reset
as the former is a little more efficient.
 1.98  16-Aug-2003  yamt use sizeof() instead of a hardcorded constant.
 1.97  16-Aug-2003  yamt current trylater/jukebox retry delay is way too long and
it has a bug in the backoff calculation. so,
- clip it to 1-60 sec. (suggested by Rick Macklem)
- use a constant multiplier instead of nfs_backoff, which
is already exponential.
- move some related constant definations to nfs.h from nqnfs.h and
prefix with NFS_ instead of NQ_ because they are not nqnfs-specific.
 1.96  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.95  23-Jul-2003  yamt when rexmitting a request due to NFSERR_JUKEBOX,
use a new xid as RFC1813 says.
 1.94  23-Jul-2003  yamt fix parenthesis mismatch in rev.1.93.
 1.93  23-Jul-2003  yamt use sizeof() instead of hardcoding the size of the array.
 1.92  29-Jun-2003  fvdl branches: 1.92.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.91  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.90  25-Jun-2003  yamt - instead of scaning a list when looking up
{a idle thread, a socket with pending requests},
maintain dedicated list of them.
- add spin locks.
 1.89  23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.88  22-May-2003  yamt poolify nfsrv_descript.
 1.87  22-May-2003  yamt interlock for nfs_rcvlock.
 1.86  21-May-2003  yamt - use FREE not free for MALLOC'ed memory.
- remove unneeded caddr_t casts.
 1.85  21-May-2003  yamt remove local definitions of TRUE and FALSE.
 1.84  21-May-2003  yamt indent
 1.83  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.82  15-Apr-2003  yamt fix indent.
 1.81  03-Apr-2003  yamt use m_copydata and m_split instead of similar inlined ones.
 1.80  02-Apr-2003  yamt use queue manipulation macros.
 1.79  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.78  01-Feb-2003  thorpej Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 1.77  01-Dec-2002  matt Make sure these all agree on the same definitons of various variables.
 1.76  27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.75  02-Aug-2002  fvdl Initialize recm to NULL inside the loop, so that a record length of
NULL will not accidentallly append bogus data (the previous record).

Derived from a fix by Matt Dillon in FreeBSD.
 1.74  12-May-2002  matt branches: 1.74.2; 1.74.4;
Eliminate commons
 1.73  17-Mar-2002  christos use the exithook mechanism to remove the exiting process from the list
of processes to be signalled in a soft mount.
 1.72  27-Feb-2002  lukem nfs_connect(): if NFSMNT_RESVPORT is set, set IP_PORTRANGE_LOW on the socket
rather than using home-grown code to find a free reserved socket.
this also results in nfs pcb's having the INP_ANONPORT and INP_LOWPORT flags
set, which is useful for netstat(1) to know.
 1.71  22-Jan-2002  minoura Back out the previous.
It was my misreading from the lack of mbuf usage...
Sorry for the mess.
 1.70  21-Jan-2002  minoura Correctly write back the updated value of the local variable to the
struct nfssvc_sock.
Affected only when a recordmark of RPC over TCP is fragmented to
multiple mbufs. I do not know whether this code has ever been executed :)
 1.69  10-Nov-2001  lukem add RCSIDs
 1.68  13-Oct-2001  simonb branches: 1.68.2;
Don't initialise the 5th element of some 4 element arrays.
 1.67  09-May-2001  fvdl branches: 1.67.2;
Suppress another case of a potentially noisy error message which
isn't fatal.
 1.66  21-Feb-2001  jdolecek branches: 1.66.2;
make some more constant arrays 'const'
 1.65  27-Dec-2000  jdolecek update commented out code to recent changes of signal structures
 1.64  27-Dec-2000  bjh21 Extra diagnostic assertion: subtle pmap bugs can ultimately lead to trying
to use NULL credentials for NFS ops, so spot them before we dereference them.
 1.63  10-Dec-2000  fvdl Make sobind() take a struct proc *. It already took curproc and
passed it down to the appropriate usrreq function, and this
allows usage for contexts that need to be explicitly different
from curproc (like in the NFS code when binding to a reserved port).
 1.62  27-Sep-2000  fvdl Avoid unused variables for V2_ONLY case.
 1.61  19-Sep-2000  bjh21 Extend NFS_V2_ONLY to remove NQNFS lease support as well. Saves another 10k.
 1.60  19-Sep-2000  fvdl "ENOBUF" on socket writes isn't really fatal; we may just be too fast
for the driver. Don't log the error, just try again. Could try to
be smart and do a backoff, but it's probably not worth the trouble.
 1.59  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.58  27-Jun-2000  mrg remove include of <vm/vm.h>
 1.57  09-Jun-2000  fvdl branches: 1.57.2;
Some tweaks to enable NFS over IPv6. The special-casing of AF_INET
should really be removed.
 1.56  27-May-2000  thorpej branches: 1.56.2;
sleep() -> tsleep()
 1.55  30-Mar-2000  augustss Remove register declarations.
 1.54  23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.53  29-Aug-1999  sommerfeld branches: 1.53.2;
Fix overzealous DIAGNOSTIC check in nfs_disconnect()
(fix pr8249, 8288)
 1.52  30-Jul-1999  fvdl Don't try to copy an mbuf that may have been freed in case of an error.
 1.51  04-Jul-1999  sommerfeld kern/5591: Fix race in the NFS socket code during umount -f and system
shutdown:

During an unmount, wake up all the processes which are waiting to lock
the socket for receive, and wait for them (and the process blocked in
soreceive, if any) to go away before blowing away the socket and the
mount structure.
 1.50  06-Mar-1999  fair branches: 1.50.2; 1.50.4;
Snatch a patch from OpenBSD to fix PRs 6529 and 7074.
Adjust fxdr_hyper() and txdr_hyper() macros.
 1.49  12-Feb-1999  thorpej Fix printf format warnings on Alpha.
 1.48  12-Nov-1998  fvdl Use different names for the "nfscon" label to tsleep(), so that it can
be seen in which one a process is sleeping.
 1.47  11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.46  09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.45  20-Jul-1998  fvdl Avoid possibly overflowing an mbuf. From Dan S. Decasper, via Chuck Cranor.
 1.44  25-Jun-1998  thorpej defopt NFSSERVER
 1.43  25-Apr-1998  matt Adapt to new sosend/soreceive and upcall (now down in sowakeup)
 1.42  19-Feb-1998  thorpej Include the NFS option header.
 1.41  30-Jan-1998  fvdl Only take the receive lock before disconnecting when doing it from
nfs_decode_args. Otherwise we might just end up locking against ourselves.

XXX workaround, will do ok for now. Proper fix forthcoming.
 1.40  16-Nov-1997  fvdl Make sure the receive lock is taken when disconnecting a socket. Also
change a check for a 'connected' socket to use the socket rather than
the mount flags.

From Matthias Drochner.
 1.39  10-Oct-1997  fvdl branches: 1.39.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.38  22-May-1997  gwr branches: 1.38.4; 1.38.6;
Temporary work-around for PR kern/3579 (from Jonathan Stone).
 1.37  12-May-1997  fvdl * If nfs_reconnect fails, be sure to release the sndlock, otherwise no
other requests will get through and the mount point will be effectively dead.
This could happen for mounts using TCP and -i and/or -s.
* Reserve enough space for UDP sockets. Fixes PR 3008, from Naofumi Honda.
 1.36  08-Apr-1997  fvdl Avoid nfsiods acquiring/releasing a lock, then acquiring it again, before
anyone else can get to it, by checking if a reply was received, and it
has thus become unnecessary to take the lock. From FreeBSD.

XXX I don't really like this, "locks" potentially suffer from the same
problem throughout the whole kernel; they should probably be FIFO everywhere.
 1.35  22-Feb-1997  fvdl Fixes from BSDI (thanks go to Keith Bostic). Original RCS messages:

date: 1995/11/30 20:37:03; author: cp; state: Exp; lines: +25 -14
Change splsoftclock() to splnet();
Make nfsrv_getstream create two copies of data when
splitting up an mbuf rather than two references to the
same external buffer. The symptom this fixes is client
hangs.

date: 1997/02/10 18:41:13; author: cp; state: Exp; lines: +4 -1
Make nfs_realign go away on sparc and add functionality to nfsm_disct.
 1.34  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.33  04-Feb-1997  fvdl branches: 1.33.2;
* Make sure a new socket is created when switching to/from NOCONN with
a mount
* Add extra printf statements to hopefully get some more info on lockups,
specifically when a send error is ignored.
 1.32  31-Jan-1997  thorpej NFSCLIENT -> NFS.
 1.31  13-Oct-1996  christos branches: 1.31.2;
revert kprintf changes
 1.30  10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.29  02-Jul-1996  fvdl Remove bogus check on record length < NFS_MINPACKET.
(From Guy Harris via Rick Macklem).
 1.28  22-May-1996  mycroft Pass a proc pointer down to the usrreq and pcbbind functions for PRU_ATTACH, PRU_BIND and
PRU_CONTROL. The usrreq interface really needs to be split up, but this will have to wait.
Remove SS_PRIV completely.
 1.27  15-Apr-1996  thorpej branches: 1.27.4;
Make this compile again on a SPARC if NFSCLIENT is defined without
NFSSERVER. (-Wall unused variable lossage)
 1.26  25-Feb-1996  fvdl Oops. Do previous fix on the right line this time.. (thanks Charles)
 1.25  25-Feb-1996  fvdl Call soreserve() with the right size for receives (from pk).
 1.24  18-Feb-1996  fvdl Bring in a merge of Rick Macklem's NFSv3 code from Lite2
 1.23  09-Feb-1996  christos nfs prototype changes
 1.22  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.21  13-Aug-1995  mycroft splnet --> splsoftnet
 1.20  02-Jun-1995  mycroft Fix more off by one errors.
 1.19  02-Jun-1995  mycroft Fix another off by one error.
 1.18  02-Jun-1995  mycroft Imported group list now starts at offset 0, not 1.
 1.17  17-Aug-1994  mycroft Convert some more lists and queues.
 1.16  17-Aug-1994  mycroft Change the reply list to a TAILQ.
 1.15  29-Jun-1994  cgd branches: 1.15.2;
New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.14  08-Jun-1994  mycroft Update to 4.4-Lite fs code, with local changes.
 1.13  24-May-1994  cgd MIN -> min, MAX -> max
 1.12  05-May-1994  cgd lots of changes: prototype migration, move lots of variables, definitions,
and structure elements around. kill some unnecessary type and macro
definitions. standardize clock handling. More changes than you'd want.
 1.11  10-Apr-1994  cgd patchkit date deletions!
 1.10  22-Dec-1993  cgd minor cleanup
 1.9  18-Dec-1993  mycroft Canonicalize all #includes.
 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  06-Sep-1993  mycroft Make nfs_timer() return void.
 1.6  03-Sep-1993  jtc Include systm.h to get prototypes (and possibly inlines) of *max functions.
 1.5  22-May-1993  cgd add include of select.h if necessary for protos, or delete if extraneous
 1.4  18-May-1993  cgd make kernel select interface be one-stop shopping & clean it all up.
 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.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.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.15.2.1  19-Aug-1994  mycroft update from trunk
 1.27.4.4  04-Mar-1997  mycroft Pull up bug fixes from -current, per fvdl.
 1.27.4.3  11-Dec-1996  mycroft From trunk:
Eliminate SS_PRIV; instead, pass down a proc pointer to the usrreq methods
that need it.
Fix numerous memory leaks and bogus return values.
 1.27.4.2  10-Jul-1996  jtc Patch from frank needed to compile without corresponding network changes
 1.27.4.1  08-Jul-1996  jtc Pulled up from rev 1.29 by request from Frank van der Linden
 1.31.2.1  14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.33.2.1  12-Mar-1997  is Merge in changes from Trunk
 1.38.6.1  08-Sep-1997  thorpej Significantly restructure the way signal state for a process is stored.
Rather than using bitmasks to redundantly store the information kept
in the process's sigacts (because the sigacts was kept in the u-area),
hang sigacts directly off the process, and access it directly.

Simplify signal setup code tremendously by storing information in
the sigacts as an array of struct sigactions, rather than in a different
format, since userspace uses sigactions.

Make sigacts sharable by adding reference counting.
 1.38.4.1  14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.39.2.2  07-Feb-1998  mellon Pull up 1.41 (fvdl)
 1.39.2.1  17-Nov-1997  thorpej Sync w/ trunk (fvdl)
 1.50.4.1  02-Aug-1999  thorpej Update from trunk.
 1.50.2.2  09-Nov-1999  he Pull up revisions 1.52-1.53 (requested by fvdl):
Fix overzealous DIAGNOSTIC check in nfs_disconnect() and
don't try to copy a possibly freed mbuf. Fixes PR#8249, PR#8288
and PR#8766.
 1.50.2.1  05-Nov-1999  cgd pull up rev 1.51 from trunk (requested by fvdl):
Avoid a panic when forcibly unmounting a hung NFS mount, e.g. at
reboot.
 1.53.2.4  12-Mar-2001  bouyer Sync with HEAD.
 1.53.2.3  05-Jan-2001  bouyer Sync with HEAD
 1.53.2.2  13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.53.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.56.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.57.2.3  04-Sep-2002  itojun pullup sys/nfs/nfs_socket.c 1.75 (fvdl)

Initialize recm to NULL inside the loop, so that a record length of
NULL will not accidentallly append bogus data (the previous record).

Derived from a fix by Matt Dillon in FreeBSD.
 1.57.2.2  15-Dec-2000  he Pull up revision 1.63 (requested by fvdl):
Fix NFS+tcp client hangs on server or network outage. Again,
please note that this introduces yet another kernel interface
change: sobind() gains an argument.
 1.57.2.1  14-Dec-2000  he Pull up revision 1.60 (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.66.2.12  11-Dec-2002  thorpej Sync with HEAD.
 1.66.2.11  18-Oct-2002  nathanw Catch up to -current.
 1.66.2.10  13-Aug-2002  nathanw Catch up to -current.
 1.66.2.9  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.66.2.8  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.66.2.7  20-Jun-2002  nathanw Catch up to -current.
 1.66.2.6  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.66.2.5  28-Feb-2002  nathanw Catch up to -current.
 1.66.2.4  14-Nov-2001  nathanw Catch up to -current.
 1.66.2.3  22-Oct-2001  nathanw Catch up to -current.
 1.66.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.66.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.67.2.6  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.67.2.5  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.67.2.4  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.67.2.3  16-Mar-2002  jdolecek Catch up with -current.
 1.67.2.2  11-Feb-2002  jdolecek Sync w/ -current.
 1.67.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.68.2.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.74.4.1  02-Aug-2002  lukem Pull up revision 1.75 (requested by fvdl in ticket #604):
Initialize recm to NULL inside the loop, so that a record length of
NULL will not accidentallly append bogus data (the previous record).
Derived from a fix by Matt Dillon in FreeBSD.
 1.74.2.1  29-Aug-2002  gehenna catch up with -current.
 1.92.2.12  11-Dec-2005  christos Sync with head.
 1.92.2.11  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.92.2.10  01-Apr-2005  skrll Sync with HEAD.
 1.92.2.9  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.92.2.8  07-Feb-2005  skrll Don't deref a NULL struct lwp *.
 1.92.2.7  21-Sep-2004  skrll Fix the sync with head I botched.
 1.92.2.6  18-Sep-2004  skrll Sync with HEAD.
 1.92.2.5  03-Sep-2004  skrll Sync with HEAD
 1.92.2.4  25-Aug-2004  skrll Sync with HEAD.
 1.92.2.3  18-Aug-2004  skrll Revert to passing struct proc for {exit,exec}hook.
 1.92.2.2  03-Aug-2004  skrll Sync with HEAD
 1.92.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.102.2.4  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.102.2.3  30-Aug-2004  tron branches: 1.102.2.3.2;
Pull up revision 1.110 via patch (requested by yamt in ticket #803):
nfs_request: a workaround for servers doing "maproot".
for i/o requests which are expected not to fail due to permission
to mimic unix file open semantics (READ, WRITE, COMMIT),
try two credentials. namely, the file owner's one and open time one.
remember which credential worked in per-file basis and try it first
next time to minimize number of retries.
ideas from Chuck Silvers. PR/23716 and PR/24987.
 1.102.2.2  14-Jul-2004  tron Pull up revision 1.108 (requested by jonathan in ticket #648):
Rename MBUFTRACE helper function m_claim() to m_claimm(),
for consistency with M_FREE() and m_freem(). Affected files:
sys/mbuf.h
kern/uipc_socket2.c
kern/uipc_mbuf.c
net/if_ethersubr.c
netatalk/ddp_input.c
nfs/nfs_socket.c
 1.102.2.1  10-Jul-2004  tron Pull up revision 1.106 via patch (requested by yamt in ticket #617):
- for tcp, use SO_RCVTIMEO to recover from server crash.
otherwise we can be stuck in soreceive forever.
the problem is pointed by Minoura Makoto. PR/25662
- clear r_rexmit on reconnect and clear r_rtt and R_TIMING on retransmit
so that the above (and soft mounts) happy.
 1.102.2.3.2.1  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.111.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.111.4.1  29-Apr-2005  kent sync with -current
 1.112.2.2  15-Dec-2005  tron Pull up following revision(s) (requested by christos in ticket #1055):
sys/nfs/nfs_socket.c: revision 1.115 via patch
Convert from nfs error values to regular errno's. Although most values of
nfs errors are chosen to be the same as errno, some of them are not and
it is better for portability to do the conversion anyway. Also a server
can return a bad error number that can cause the server to crash, because
it can have the high bits that are used internally set. This was the case
with amd. Finally nfs_request() should return a valid errno, because we
can return a bogus value to userland. Thanks to rpaulo for debugging this.
 1.112.2.1  04-Apr-2005  tron Pull up revision 1.113 (requested by yamt in ticket #89):
nfsrv_rcv: don't do so_receive from socket upcall context.
while there's little benefits, it complicates locking and confuses
flow control.
 1.114.2.9  27-Feb-2008  yamt revert incomplete nfs client locking for now.
 1.114.2.8  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.114.2.7  21-Jan-2008  yamt sync with head
 1.114.2.6  07-Dec-2007  yamt sync with head
 1.114.2.5  27-Oct-2007  yamt sync with head.
 1.114.2.4  03-Sep-2007  yamt sync with head.
 1.114.2.3  26-Feb-2007  yamt sync with head.
 1.114.2.2  30-Dec-2006  yamt sync with head.
 1.114.2.1  21-Jun-2006  yamt sync with head.
 1.117.6.1  22-Nov-2005  yamt sync with head.
 1.120.2.2  15-Jan-2006  yamt sync with head.
 1.120.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.122.4.3  01-Jun-2006  kardel Sync with head.
 1.122.4.2  22-Apr-2006  simonb Sync with head.
 1.122.4.1  04-Feb-2006  simonb Adapt for timecounters: mostly use get*time() and use "time_second"
instead of "time.tv_sec".
 1.122.2.1  09-Sep-2006  rpaulo sync with head
 1.126.6.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.126.4.12  11-May-2006  elad sync with head
 1.126.4.11  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.126.4.10  19-Apr-2006  elad sync with head.
 1.126.4.9  14-Apr-2006  elad Plug some possible leaks of kauth_cred_t.
 1.126.4.8  13-Apr-2006  elad Add a missing kauth_cred_alloc() and remove some misleading code and
comment.
 1.126.4.7  31-Mar-2006  elad oops. fix function names... pointed out by yamt@, thanks!
 1.126.4.6  31-Mar-2006  elad fill up real/saved [ug]ids too.
 1.126.4.5  14-Mar-2006  elad Use kauth_cred_[sg]etgroups() where appropriate.
 1.126.4.4  10-Mar-2006  elad Cleanup more interface abuse.

Make nfsrv_setcred() take a kauth_cred_t * as outcred. The original code
just modified it directly; we can't do that, nor do we want to.

Get rid of another case of kauth_cred_zero() followed by kauth_cred_hold()
and use kauth_cred_clone() to make sure we don't leave out important
members.

Add another DIAGNOSTIC check for reference count of above one.

Again, this should be tested.
 1.126.4.3  10-Mar-2006  elad Okay, what I've done here is pretty bogus, and trying to use kauth_cred_t
as something it's not. Then again, it was part of a fast sweep so I have
good excuses. :)

DON'T kauth_cred_zero() and then kauth_cred_hold(); that's guaranteed to
trip over trying to lock an uninitialized lock. Also, kauth_cred_t now
contains more than just a struct ucred, so treat it properly.

Use a call to kauth_cred_copy() to ensure we have reference count of
one, and sprinkle some DIAGNOSTIC check to let us know if we ever leak
memory.

Also, don't forget to set proper values for the real/saved user- and
group-ids.

This should be tested at some point...
 1.126.4.2  10-Mar-2006  elad Remove some #if 0'd code.

There's no need to call kauth_cred_setngroups() here because right above
we use kauth_cred_addgroup() that does the management of ngroups for us.

Also, for the same reason, there's no need to call nfsrvw_sort(), because
we are guaranteed to have the group list sorted at all times.
 1.126.4.1  08-Mar-2006  elad Adapt to kernel authorization KPI.

This could use some testing...
 1.126.2.4  03-Sep-2006  yamt sync with head.
 1.126.2.3  11-Aug-2006  yamt sync with head
 1.126.2.2  26-Jun-2006  yamt sync with head.
 1.126.2.1  24-May-2006  yamt sync with head.
 1.132.2.2  19-Jun-2006  chap Sync with head.
 1.132.2.1  19-May-2006  chap file nfs_socket.c was added on branch chap-midi on 2006-06-19 04:10:37 +0000
 1.135.2.1  13-Jul-2006  gdamore Merge from HEAD.
 1.138.4.2  10-Dec-2006  yamt sync with head.
 1.138.4.1  22-Oct-2006  yamt sync with head
 1.138.2.3  12-Jan-2007  ad Sync with head.
 1.138.2.2  18-Nov-2006  ad Sync with head.
 1.138.2.1  21-Oct-2006  ad Update for sigpending1() change.
 1.145.2.4  07-May-2007  yamt sync with head.
 1.145.2.3  24-Mar-2007  yamt sync with head.
 1.145.2.2  12-Mar-2007  rmind Sync with HEAD.
 1.145.2.1  28-Feb-2007  yamt sync with head. (somehow missed in the previous)
 1.148.2.10  01-Nov-2007  yamt fix a compilation problem w/o NFSSERVER.
reported by Juan RP via Andrew Doran.
 1.148.2.9  27-Aug-2007  yamt - fix/add assertions.
- fix numnfsrvcache.
 1.148.2.8  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.148.2.7  20-Aug-2007  ad Sync with HEAD.
 1.148.2.6  15-Jul-2007  ad Sync with head.
 1.148.2.5  01-Jul-2007  ad Adapt to callout API change.
 1.148.2.4  09-Jun-2007  ad Sync with head.
 1.148.2.3  08-Jun-2007  ad Sync with head.
 1.148.2.2  13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.148.2.1  13-Mar-2007  ad Sync with head.
 1.149.2.1  11-Jul-2007  mjf Sync with head.
 1.160.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.162.2.3  09-Dec-2007  jmcneill Sync with HEAD.
 1.162.2.2  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.162.2.1  09-Aug-2007  jmcneill Sync with HEAD.
 1.163.8.2  05-Aug-2007  yamt use kpause rather than lbolt.
 1.163.8.1  05-Aug-2007  yamt file nfs_socket.c was added on branch matt-mips64 on 2007-08-05 09:40:40 +0000
 1.163.6.1  25-Oct-2007  bouyer Sync with HEAD.
 1.163.2.2  09-Jan-2008  matt sync with HEAD
 1.163.2.1  06-Nov-2007  matt sync with HEAD
 1.164.4.4  29-Dec-2007  yamt to prepare merge, put nfsd back under kernel_lock for now.
 1.164.4.3  08-Dec-2007  ad Sync with head.
 1.164.4.2  04-Dec-2007  yamt apply the following change, which seems to get lost during
vmlocking -> vmlocking2 transition.

Module Name: src
Committed By: yamt
Date: Sun Oct 21 08:23:20 UTC 2007

Modified Files:
src/sys/nfs: nfs_socket.c nfs_var.h

Log Message:
remove lwp argument from nfs_reconnect and always use &lwp0
because who triggers a reconnect doesn't really matter here. PR/37145.


To generate a diff of this commit:
cvs rdiff -r1.163 -r1.164 src/sys/nfs/nfs_socket.c
cvs rdiff -r1.72 -r1.73 src/sys/nfs/nfs_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
 1.164.4.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.164.2.2  18-Feb-2008  mjf Sync with HEAD.
 1.164.2.1  08-Dec-2007  mjf Sync with HEAD.
 1.165.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.167.6.5  17-Jan-2009  mjf Sync with HEAD.
 1.167.6.4  05-Oct-2008  mjf Sync with HEAD.
 1.167.6.3  28-Sep-2008  mjf Sync with HEAD.
 1.167.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.167.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.169.2.1  18-May-2008  yamt sync with head.
 1.170.8.2  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.170.8.1  19-Oct-2008  haad Sync with HEAD.
 1.170.4.2  10-Oct-2008  skrll Sync with HEAD.
 1.170.4.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.170.2.7  11-Mar-2010  yamt sync with head
 1.170.2.6  19-Jul-2009  yamt debug printf and comments. no functional changes.
 1.170.2.5  16-Jul-2009  yamt remove sndlock. it's superseded by nm_solock.
suggested by Andrew Doran.
 1.170.2.4  04-May-2009  yamt fix a merge botch.
 1.170.2.3  04-May-2009  yamt fix merge botches.
 1.170.2.2  04-May-2009  yamt sync with head.
 1.170.2.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.173.4.9  24-Apr-2011  riz Pull up following revision(s) (requested by tls in ticket #1600):
sys/nfs/nfs_socket.c: revision 1.189
As suggested by matt@: change socket buffer reservations for NFS send/receive
to 3 times max RPC size rather than 2 times. Avoids nasty TCP stalls observed
at Panix. Will require increase to sbmax via sysctl for those running really
huge NFS rsize/wsize (>64K).
 1.173.4.8  29-Mar-2011  riz Pull up following revision(s) (requested by tls in ticket #1583):
sys/nfs/nfs_socket.c: revision 1.186
nfs_msg: #if 0 out tprintf for now and comment why.
 1.173.4.7  29-Mar-2011  riz Pull up following revision(s) (requested by tls in ticket #1582):
sys/nfs/nfs_socket.c: revision 1.185
nfs_request: fix races which break congestion window and make nfs client stuck.
 1.173.4.6  29-Mar-2011  riz Pull up following revision(s) (requested by tls in ticket #1581):
sys/nfs/nfs_socket.c: revision 1.181
If send fails with EMSGSIZE for whatever reason, it's unlikely to
succeed no matter how hard we retry. So just fail the request.
 1.173.4.5  29-Mar-2011  riz Pull up following revision(s) (requested by tls in ticket #1580):
sys/nfs/nfs_socket.c: revision 1.175
avoid noisy nfs_timer/nfs_reply DEBUG output that occurs when the
NFS server goes away. use ratelimit(9) and only print the console
error once every 10 seconds. PR#31562.
 1.173.4.4  13-Nov-2009  sborrill Pull up the following revisions(s) (requested by bouyer in ticket #1128):
sys/nfs/nfs_socket.c: revision 1.182

Handle EWOULDBLOCK the same way as EPIPE. It seems the TCP socket layer
can return EWOULDBLOCK on some occasion when the connection is broken.
 1.173.4.3  06-Feb-2009  snj branches: 1.173.4.3.4;
Pull up following revision(s) (requested by ad in ticket #412):
sys/nfs/nfs_socket.c: revision 1.178
PR kern/40491 5.0: nfs timer can crash/break on smp
Hack around it by acquiring softnet_lock around the client-side timer loop.
 1.173.4.2  02-Feb-2009  snj Pull up following revision(s) (requested by yamt in ticket #393):
sys/kern/uipc_socket.c: revision 1.185
sys/kern/uipc_socket2.c: revision 1.101
sys/kern/uipc_syscalls.c: revision 1.135
sys/miscfs/portal/portal_vnops.c: revision 1.81
sys/netsmb/smb_trantcp.c: revision 1.40
sys/nfs/nfs_socket.c: revision 1.177
sys/sys/socketvar.h: revision 1.118
restore the pre socket locking patch signal behaviour.
this fixes a busy-loop in nfs_connect.
 1.173.4.1  02-Feb-2009  snj Pull up following revision(s) (requested by mrg in ticket #390):
sys/nfs/nfs_socket.c: revision 1.176
Actually enforce the maximum timeout (60s by default) rather
than backing off to 256*SRTT. This is why it sometimes could take
hours for a NFS mount to come back when the server returned.
contributed anonymously.
 1.173.4.3.4.1  20-Apr-2010  matt Pullin some NFS fixes from netbsd-5.
 1.173.2.3  28-Apr-2009  skrll Sync with HEAD.
 1.173.2.2  03-Mar-2009  skrll Sync with HEAD.
 1.173.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.178.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.185.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.187.2.2  21-Apr-2011  rmind sync with head
 1.187.2.1  05-Mar-2011  rmind sync with head
 1.188.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.189.18.2  18-May-2014  rmind sync with head
 1.189.18.1  28-Aug-2013  rmind Checkpoint work in progress:
- Initial split of the protocol user-request method into the following
methods: pr_attach, pr_detach and pr_generic for old the pr_usrreq.
- Adjust socreate(9) and sonewconn(9) to call pr_attach without the
socket lock held (as a preparation for the locking scheme adjustment).
- Adjust all pr_attach routines to assert that PCB is not set.
- Sprinkle various comments, document some routines and their locking.
- Remove M_PCB, replace with kmem(9).
- Fix few bugs spotted on the way.
 1.189.14.2  03-Dec-2017  jdolecek update from HEAD
 1.189.14.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.189.4.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.190.2.1  10-Aug-2014  tls Rebase.
 1.192.4.1  10-Jul-2016  martin Pull up following revision(s) (requested by christos in ticket #1184):
sys/nfs/nfs_socket.c: revision 1.198
sys/nfs/nfs_clntsocket.c: revision 1.5
Serialize all access to the NFS request queue via splsoftnet(). Fixes random
crashes.
 1.192.2.2  10-Jul-2016  martin Pull up following revision(s) (requested by christos in ticket #1184):
sys/nfs/nfs_socket.c: revision 1.198
sys/nfs/nfs_clntsocket.c: revision 1.5
Serialize all access to the NFS request queue via splsoftnet(). Fixes random
crashes.
XXX: Pullup-7
 1.192.2.1  04-Nov-2015  riz Pull up following revision(s) (requested by manu in ticket #882):
sbin/umount/umount.c: revision 1.48
sys/nfs/nfsmount.h: revision 1.53
sys/nfs/nfs_var.h: revision 1.94
sys/nfs/nfs_iod.c: revision 1.7
sys/nfs/nfs_socket.c: revision 1.197
sys/nfs/nfs_bio.c: revision 1.191
sys/nfs/nfs_vfsops.c: revision 1.230
sys/nfs/nfs_clntsocket.c: revision 1.3
Remove useless and harmful sync(2) call in umount(8)
Remove sync(2) call before unmount(2) in umount(8). This sync(2) is useless
since unmount(2) will perform a VFS_SYNC anyway.
But moreover, this sync(2) may be harmful, as there are some situation where
it cannot return (unreachable NFS server, for instance), causing umount -f
to be uneffective.
Fix soft NFS force unmount
For many reasons, forcibly unmounting a soft NFS mount could hang forever.
Here are the fixes:
- Introduce decents timeouts in operation that awaited NFS server reply.
- On timeout, fails operations on soft mounts with EIO.
- Introduce NFSMNT_DISMNTFORCE to let the filesystem know that a
force unmount is ongoing. This causes timeouts to be reduced and
prevents the NFS client to attempt reconnecting to the NFS server.
Also fix a race condition where some asynchronous I/O could reference
destroyed mount structures. We fix this by awaiting asynchronous I/O
to drain before proceeding.
Reviewed by Chuck Silvers.
 1.193.2.4  09-Jul-2016  skrll Sync with HEAD
 1.193.2.3  22-Sep-2015  skrll Sync with HEAD
 1.193.2.2  06-Jun-2015  skrll Sync with HEAD
 1.193.2.1  06-Apr-2015  skrll Sync with HEAD
 1.198.10.1  08-Jun-2018  martin Pull up following revision(s) (requested by maya in ticket #856):

sys/nfs/nfs.h: revision 1.76
sys/nfs/nfs_subs.c: revision 1.230
sys/nfs/nfs_socket.c: revision 1.199
sys/nfs/nfs_clntsocket.c: revision 1.6

PR/40491: From Tobias Ulmer in tech-kern@:
1. Protect the nfs request queue with its own mutex
2. make the nfs_receive queue check for signals so that intr mounts
can be interrupted.

XXX: pullup-8
 1.199.4.1  10-Jun-2019  christos Sync with HEAD
 1.199.2.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)

RSS XML Feed