Home | History | Annotate | Download | only in nfs
History log of /src/sys/nfs/nfsmount.h
RevisionDateAuthorComments
 1.54  07-Dec-2024  riastradh sys/nfs/nfs: Add some missing includes and include guards.

Fix up some minor KNF issues while here.

No functional change intended (except to enable things to build that
might not have built before because of previously required #include
ordering).
 1.53  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.52  30-May-2014  hannken branches: 1.52.2; 1.52.4;
Change NFS from rbtree to vcache.
 1.51  22-Jan-2011  matt branches: 1.51.14; 1.51.28;
Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.
 1.50  25-Sep-2010  matt branches: 1.50.2; 1.50.4;
Rename rb.h to rbtree.h, as it is more appropriate (c.f. ptree.h). Also
helps find code that hasn't been updated to use the new rbtree API.
 1.49  14-Mar-2009  dsl branches: 1.49.2; 1.49.4;
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.48  22-Oct-2008  matt branches: 1.48.2; 1.48.8;
Don't need nfs_vfs_reinit anymore since we don't resize tables anymore.
Move reinit code to init case.
 1.47  22-Oct-2008  matt Change NFS to use a RB-tree for its FH->nfsnode lookups.
 1.46  31-Jul-2007  pooka branches: 1.46.24; 1.46.28; 1.46.34; 1.46.36;
* nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
use VFS_PROTOS() instead of manually prototyping the methods
 1.45  12-Jul-2007  dsl branches: 1.45.2;
Change the VFS_MOUNT() interface so that the 'data' buffer passed to the
fs code is a kernel buffer, pass though the length of the buffer as well.
Since the length of the userspace buffer isn'it (yet) passed through the mount
system call, add a field to the vfsops structure containing the default length.
Split sys_mount() for calls from compat code.
Ride one of the recent kernel version changes - old fs LKMs will load, but
sys_mount() will reject any attempt to use them.
 1.44  29-Apr-2007  yamt use condvar.
 1.43  29-Apr-2007  yamt use mutex and condver.
 1.42  15-Feb-2007  yamt branches: 1.42.2; 1.42.6; 1.42.8;
use mutex and rwlock rather than lockmgr.
 1.41  27-Dec-2006  yamt remove nqnfs.
 1.40  13-Jul-2006  martin branches: 1.40.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

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

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.39  14-May-2006  elad branches: 1.39.4;
integrate kauth.
 1.38  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.37  11-Dec-2005  christos branches: 1.37.4; 1.37.6; 1.37.8; 1.37.10; 1.37.12;
merge ktrace-lwp.
 1.36  25-Nov-2005  thorpej Use a once control to initialize the NFS server / client shared data
from nfs_vfs_init() or sys_nfssvc(). Remove the nfs_init() call from
main().
 1.35  23-Sep-2005  jmmv branches: 1.35.6;
Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
 1.34  18-Sep-2005  christos Allow turning off the attribute cache.
 1.33  19-Jan-2005  yamt branches: 1.33.6; 1.33.8;
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.32  22-May-2004  jonathan branches: 1.32.4;
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.31  27-Apr-2004  jrf First pass for some caddr_t removal and changes to get rid of it where we
no longer use and/or need it

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

Compiled fine and ran for about a day. Approved/reviewed by
christos@netbsd.org and gimpy@netbsd.org.
 1.30  21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.29  03-Oct-2003  yamt branches: 1.29.4;
terminate snprintb 'new' format strings correctly.
(fixes overrun in mount_*)
 1.28  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.27  29-Jun-2003  fvdl branches: 1.27.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.26  29-Jun-2003  thorpej Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.25  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.24  03-May-2003  yamt better handling of write verifier change.
 1.23  09-Apr-2003  yamt rename nm_verf to nm_writeverf because it's confusing with nm_verf{str,len}.
 1.22  21-Sep-2002  christos MNT_GETARGS support
 1.21  15-Sep-2001  chs add a new VFS op, vfs_reinit, which is called when desiredvnodes is
adjusted via sysctl. file systems that have hash tables which are
sized based on the value of this variable now resize those hash tables
using the new value. the max number of FFS softdeps is also recalculated.

convert various file systems to use the <sys/queue.h> macros for
their hash tables.
 1.20  12-Feb-2001  fvdl branches: 1.20.2; 1.20.4; 1.20.6;
Instead of storing the filehandle in the mount structure, store the
vnode pointer. This avoids a locking problem with nfs_nget, and
can be done because we always have a reference on the root vnode
of the filesystem.
 1.19  16-Mar-2000  jdolecek Add new VFS op routine - vfs_done and call it on filesystem detach
in vfs_detach(). vfs_done may free global filesystem's resources,
typically those allocated in respective filesystem's init function.
Needed so those filesystems which went in via LKM have a chance to
clean after themselves before unloading. This fixes random panics
when LKM for filesystem using pools was loaded and unloaded several
times.

For each leaf filesystem, add appropriate vfs_done routine.
 1.18  04-Jul-1999  sommerfeld branches: 1.18.2;
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.17  26-Feb-1999  wrstuden branches: 1.17.2; 1.17.4;
Modify vfsops to seperate vfs_fhtovp() into two routines. vfs_fhtovp() now
only handles the file handle to vnode conversion, and a new call,
vfs_checkexp(), performs the export verification.
 1.16  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.15  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.14  17-Jul-1997  fvdl branches: 1.14.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.13  22-Dec-1996  cgd Change the second and third args to struct vfsops' (*vfs_mount)() to
'const char *', and 'void *', respectively. The second arg is taken directly
from user arguments, and is const there, so must be const in the prototypes
and functions. The third arg is also taken directly from user arguments.
It doesn't have to be changed, but since it's cleaner to keep the type
the same as the user arg's type, and I'm already making the 'const char *'
change...
 1.12  03-Dec-1996  thorpej Make NFSSERVER work without NFSCLIENT. This is achieved by splitting
the client and server/shared data initialization into separate functions,
and calling the server/shared initialization directly from main().
Problem noted in PR #1308 (Kenneth Stailey) and PR #1780 (Chris Demetriou).
Fix suggested in PR #1780 by Chris Demetriou, and munged a bit by me,
and OK'd by Frank van der Linden <fvdl@netbsd.org>.
 1.11  02-Dec-1996  thorpej 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.10  18-Feb-1996  fvdl Bring in a merge of Rick Macklem's NFSv3 code from Lite2
 1.9  09-Feb-1996  christos nfs prototype changes
 1.8  26-Mar-1995  jtc KERNEL -> _KERNEL
 1.7  13-Dec-1994  mycroft Sync with CSRG.
 1.6  18-Aug-1994  mycroft More LIST/CIRCLEQ migration.
 1.5  29-Jun-1994  cgd branches: 1.5.2;
New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.4  08-Jun-1994  mycroft Update to 4.4-Lite fs code, with local changes.
 1.3  27-Mar-1994  cgd expand uid_t/gid_t/off_t
 1.2  20-May-1993  cgd branches: 1.2.4;
more rcs id adding and header cleanup. i like vi macros!
 1.1  20-Apr-1993  mycroft branches: 1.1.1;
Restore files lost during crash.
 1.1.1.2  01-Mar-1998  fvdl Import 4.4BSD-Lite2
 1.1.1.1  01-Mar-1998  fvdl Import 4.4BSD-Lite for reference
 1.2.4.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.5.2.1  19-Aug-1994  mycroft update from trunk
 1.14.2.1  14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.17.4.1  02-Aug-1999  thorpej Update from trunk.
 1.17.2.1  05-Nov-1999  cgd pull up rev 1.18 from trunk (requested by fvdl):
Avoid a panic when forcibly unmounting a hung NFS mount, e.g. at
reboot.
 1.18.2.2  12-Mar-2001  bouyer Sync with HEAD.
 1.18.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.20.6.1  01-Oct-2001  fvdl Catch up with -current.
 1.20.4.2  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.20.4.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.2.2  06-Oct-2002  thorpej Sync with HEAD.
 1.20.2.1  21-Sep-2001  nathanw Catch up to -current.
 1.27.2.9  11-Dec-2005  christos Sync with head.
 1.27.2.8  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.27.2.7  24-Jan-2005  skrll Sync with HEAD.
 1.27.2.6  30-Oct-2004  skrll s/p/l/ for the struct lwp * arg.
 1.27.2.5  21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.2.4  18-Sep-2004  skrll Sync with HEAD.
 1.27.2.3  24-Aug-2004  skrll Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.27.2.2  03-Aug-2004  skrll Sync with HEAD
 1.27.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.29.4.1  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.32.4.1  29-Apr-2005  kent sync with -current
 1.33.8.4  03-Sep-2007  yamt sync with head.
 1.33.8.3  26-Feb-2007  yamt sync with head.
 1.33.8.2  30-Dec-2006  yamt sync with head.
 1.33.8.1  21-Jun-2006  yamt sync with head.
 1.33.6.1  26-Sep-2005  tron Pull up following revision(s) (requested by christos in ticket #816):
sys/nfs/nfs.h: revision 1.49
sys/nfs/nfsmount.h: revision 1.34
Allow turning off the attribute cache.
 1.35.6.1  29-Nov-2005  yamt sync with head.
 1.37.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.37.10.2  19-Apr-2006  elad sync with head.
 1.37.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.

This could use some testing...
 1.37.8.2  11-Aug-2006  yamt sync with head
 1.37.8.1  24-May-2006  yamt sync with head.
 1.37.6.2  01-Jun-2006  kardel Sync with head.
 1.37.6.1  22-Apr-2006  simonb Sync with head.
 1.37.4.1  09-Sep-2006  rpaulo sync with head
 1.39.4.1  13-Jul-2006  gdamore Merge from HEAD.
 1.40.4.1  12-Jan-2007  ad Sync with head.
 1.42.8.1  11-Jul-2007  mjf Sync with head.
 1.42.6.4  20-Aug-2007  ad Sync with HEAD.
 1.42.6.3  15-Jul-2007  ad Sync with head.
 1.42.6.2  08-Jun-2007  ad Sync with head.
 1.42.6.1  13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.42.2.1  07-May-2007  yamt sync with head.
 1.45.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.46.36.2  31-Jul-2007  pooka * nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
use VFS_PROTOS() instead of manually prototyping the methods
 1.46.36.1  31-Jul-2007  pooka file nfsmount.h was added on branch matt-mips64 on 2007-07-31 21:14:20 +0000
 1.46.34.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.46.28.4  09-Oct-2010  yamt sync with head
 1.46.28.3  16-Jul-2009  yamt remove sndlock. it's superseded by nm_solock.
suggested by Andrew Doran.
 1.46.28.2  04-May-2009  yamt sync with head.
 1.46.28.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.46.24.1  17-Jan-2009  mjf Sync with HEAD.
 1.48.8.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.48.2.1  28-Apr-2009  skrll Sync with HEAD.
 1.49.4.1  05-Mar-2011  rmind sync with head
 1.49.2.1  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.50.4.1  08-Feb-2011  bouyer Sync with HEAD
 1.50.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.51.28.1  10-Aug-2014  tls Rebase.
 1.51.14.2  03-Dec-2017  jdolecek update from HEAD
 1.51.14.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.52.4.1  22-Sep-2015  skrll Sync with HEAD
 1.52.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.

RSS XML Feed