summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient/nfs_vfsops.c
Commit message (Collapse)AuthorAgeFilesLines
* 1. Consolidate mount struct allocation/destruction into a common code inkan2003-11-121-23/+3
| | | | | | | | | | | | | | | | | | | | | | | vfs_mount_alloc/vfs_mount_destroy functions and take care to completely destroy the mount point along with its locks. Mount struct has grown in coplexity recently and depending on each failure path to destroy it completely isn't working anymore. 2. Eliminate largely identical vfs_mount and vfs_unmount question by moving the code to handle both cases into a newly introduced vfs_domount function. 3. Simplify nfs_mount_diskless to always expect an allocated mount struct and never attempt an allocation/destruction itself. The vfs_allocroot allocation was there to support 'magic' swap space configuration for diskless clients that was already removed by PHK some time ago. 4. Include a vfs_buildopts cleanups by Peter Edwards to validate the sanity of nmount parameters passed from userland. Submitted by: (4) Peter Edwards <peter.edwards@openet-telecom.com> Reviewed by: rwatson
* Assert GIANT_REQUIRED where sockets are manipulated. This issam2003-11-071-0/+2
| | | | | | | preparatory for MPSAFE network commits and ongoing socket locking work. Supported by: FreeBSD Foundation
* Remove mntvnode_mtx and replace it with per-mountpoint mutex.kan2003-11-051-6/+7
| | | | | | | | | | Introduce two new macros MNT_ILOCK(mp)/MNT_IUNLOCK(mp) to operate on this mutex transparently. Eventually new mutex will be protecting more fields in struct mount, not only vnode list. Discussed with: jeff
* Take care not to call vput if thread used in corresponding vgetkan2003-11-021-1/+2
| | | | | | | | | | wasn't curthread, i.e. when we receive a thread pointer to use as a function argument. Use VOP_UNLOCK/vrele in these cases. The only case there td != curthread known at the moment is boot() calling sync with thread0 pointer. This fixes the panic on shutdown people have reported.
* - Remove an incorrect XXX comment. This code does respect the XLOCK sincejeff2003-10-051-1/+0
| | | | it uses vget() which will fail if the identity changes.
* - Acquire the vnode interlock prior to dropping the mntvnode_mtx.jeff2003-10-041-1/+2
| | | | | - Make a note of the lack of XLOCK protection in this code. We would access a vnode while it is changing identities without Giant.
* Remove the magic way of configuring NFS backed swap.phk2003-08-151-63/+0
| | | | | | | | | | | | | This code dates back to the very first diskless support on FreeBSD, back when swapon(8) couldn't simply be run on a NFS backed file. Suggested replacement command sequence on the client: dd if=/dev/zero of=/swapfile bs=1k count=1 oseek=100000 swapon /swapfile rm -f /swapfile For whatever value of 100000 you want.
* Initialize struct vfsops C99-sparsely.phk2003-06-121-14/+7
| | | | | Submitted by: hmp Reviewed by: phk
* Deal with the possibility of negative available space from the file serverpeter2003-05-191-3/+6
| | | | | | | | to avoid Bad Things(TM) happening (eg: df crashing with a floating point exception). Submitted by: Harold Gutch <logix@foobar.franken.de> Approved by: re (scottl)
* Deprecate machine/limits.h in favor of new sys/limits.h.kan2003-04-291-2/+1
| | | | | | | Change all in-tree consumers to include <sys/limits.h> Discussed on: standards@ Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
* Fix a bug with df on large (>1TB) nfsv3 file servers on 32 bit clientpeter2003-04-241-11/+23
| | | | | | | machines where the 'long' number of blocks in struct statfs wont fit. Instead of chosing an artificial 512 byte block size, simply scale it up until we avoid an overflow. NFSv3 reports the sizes in bytes, and the blocksize is a figment of nfsclient's imagination.
* Back out M_* changes, per decision of the TRB.imp2003-02-191-1/+1
| | | | Approved by: trb
* Provide a sysctl to allow defaulting of the connectionless (-c) featuredillon2003-01-221-0/+15
| | | | | | | | to mount_nfs. The sysctl defaults to 1 (paranoid mode). Setting it to 0 will allow an NFS client to receive replies on a different IP then they were sent to by default. Submitted by: Sean Eric Fagan <sef@kithrup.com>
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-1/+1
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* do not try to free a mountpoint that we did not allocate.dillon2002-12-211-4/+9
| | | | X-MFC after: immediately
* Don't examine an un-initialized variable.phk2002-10-201-4/+0
| | | | Spotted by: FlexeLint.
* Be consistent about "static" functions: if the function is markedphk2002-09-281-1/+1
| | | | | | static in its prototype, mark it static at the definition too. Inspired by: FlexeLint warning #512
* Remove an errant debugging printf that got left in during my lastrwatson2002-09-271-1/+0
| | | | | | commit. Pointed out by: guido
* Apparently pxeboot passes in a mygateway of non-zero sin lengthrwatson2002-09-261-1/+6
| | | | | | | | | | from DHCP in the event that no gateway is returned from DHCP, breaking the assumption that we skip the routing insertion of the gateway if the sin length is zero. Check also for s_addr of 0 to avoid the "Oh no, adding my default route failed" panic, making it possible to pxeboot machines on segments without default routes. Arguably this could be a bug in pxeboot, or in the TUNABLE code, but this makes my boxes boot.
* - Lock access to the buf lists.jeff2002-09-251-2/+2
| | | | | - Use vrefcnt() where appropriate. - Add some locking asserts.
* Moved nfs_diskless setup code from autoconf.c to nfsclient/nfs_diskless.cjake2002-09-221-5/+8
| | | | | | | so that it is MI. Allow nfs_mountroot to return an error if the nfs_diskless struct is not valid, rather than panicing later on. Call nfs_setup_diskless() from nfs_mountroot if NFS_ROOT is defined, like bootpc_init(). Removed legacy root mount support for sparc64, and enabled NFS_ROOT by default.
* Now that we have a cached mount credential in struct mount, use it isteadphk2002-09-081-3/+0
| | | | of a private cached copy.
* Introduce typedefs for the member functions of struct vfsops and employphk2002-08-131-8/+5
| | | | | | | these in the main filesystems. This does not change the resulting code but makes the source a little bit more grepable. Sponsored by: DARPA and NAI Labs.
* - Replace v_flag with v_iflag and v_vflagjeff2002-08-041-2/+3
| | | | | | | | | | | | | | | - v_vflag is protected by the vnode lock and is used when synchronization with VOP calls is needed. - v_iflag is protected by interlock and is used for dealing with vnode management issues. These flags include X/O LOCK, FREE, DOOMED, etc. - All accesses to v_iflag and v_vflag have either been locked or marked with mp_fixme's. - Many ASSERT_VOP_LOCKED calls have been added where the locking was not clear. - Many functions in vfs_subr.c were restructured to provide for stronger locking. Idea stolen from: BSD/OS
* Convert old style (type foo *)0 casts to NULLsdillon2002-07-111-4/+4
| | | | | PR: kern/40360 Requested by: Hiten PAndya via direct email
* More s/file system/filesystem/gtrhodes2002-05-161-2/+2
|
* We don't need the arp kludge any more.phk2002-04-281-7/+0
|
* Remove references to vm_zone.h and switch over to the new uma API.jeff2002-03-201-5/+5
|
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredjhb2002-02-271-6/+6
| | | | reference.
* Permit NFS filesystems to be forcibly unmounted when the server isiedowse2002-01-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | down, even if there are hung processes and the mount is non- interruptible. This works by having nfs_unmount call a new function nfs_nmcancelreqs() in the FORCECLOSE case. It scans the list of outstanding requests and marks as interrupted any requests belonging to the specified mount. Then it waits up to 30 seconds for all requests to terminate. A few other changes are necessary to support this: - Unconditionally set a socket timeout so that even hard mounts are guaranteed to occasionally check the R_SOFTTERM flag on requests. For hard mounts this flag can only be set by nfs_nmcancelreqs(). - Reject requests on a mount that is currently being unmounted. - Never grant the receive lock to a request that has been cancelled. This should also avoid an old problem where a forced NFS unmount could cause a crash; it occurred when a VOP on an unlocked vnode (usually VOP_GETATTR) was in progress at the time of the forced unmount.
* o Remove an errant ';' introduced in the last revision.alc2002-01-011-2/+1
| | | | o Remove an unused variable.
* o Remove premature use of nmp->nm_cred, it hasn't been initialized yet.rwatson2002-01-011-1/+1
|
* o Pass td into nfs_mountroot() to eliminate an XXX'd curthread use.rwatson2001-12-311-3/+2
| | | | | | | Since it's in the parent function anyway, might as well pass it another layer down. Obtained from: TrustedBSD Project
* o Remove premature leakage of use of td_ucred from base source tree:rwatson2001-12-311-3/+3
| | | | instead, use td->td_proc->p_ucred.
* o Make the credential used by socreate() an explicit argument torwatson2001-12-311-5/+12
| | | | | | | | | | | | | | socreate(), rather than getting it implicitly from the thread argument. o Make NFS cache the credential provided at mount-time, and use the cached credential (nfsmount->nm_cred) when making calls to socreate() on initially connecting, or reconnecting the socket. This fixes bugs involving NFS over TCP and ipfw uid/gid rules, as well as bugs involving NFS and mandatory access control implementations. Reviewed by: freebsd-arch
* Avoid passing the variable `tl' to functions that just use it foriedowse2001-12-181-2/+1
| | | | | | | | | | | | | temporary storage. In the old NFS code it wasn't at all clear if the value of `tl' was used across or after macro calls, but I'm fairly confident that the convention was to keep its use local. Each ex-macro function now uses a local version of this variable, so all of the double-indirection goes away. The only exception to the `local use' rule for `tl' is nfsm_clget(), which is left unchanged by this commit. Reviewed by: peter
* Allow users to use the 'nolockd' or -L options with mount_nfs in orderalfred2001-11-121-3/+3
| | | | | | to avoid the need for rpc.lockd to perform client locks. Using this option a user can revert back to using local locks for NFS mounts like we did before we had rpc.lockd.
* Change the vnode list under the mount point from a LIST to a TAILQdillon2001-10-231-2/+2
| | | | | | in preparation for an implementation of limiting code for kern.maxvnodes. MFC after: 3 days
* Make nfsm_dissect() have an obvious return value.peter2001-09-271-2/+2
|
* Add the magic marker so that loader and kldload(2) can find this inpeter2001-09-201-0/+4
| | | | module form automagically.
* Cleanup and split of nfs client and server code.peter2001-09-181-172/+94
| | | | This builds on the top of several repo-copies.
* KSE Milestone 2julian2001-09-121-34/+34
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Check the filehandle size when mounting.peter2001-07-301-0/+2
| | | | Obtained from: Constantine Sapuntzakis <csapuntz@openbsd.org>
* - Protect the mnt_vnode list with the mntvnode lock.jhb2001-06-281-5/+16
| | | | - Use queue(9) macros.
* Change the second argument of vflush() to an integer that specifiesiedowse2001-05-161-28/+4
| | | | | | | | | | | | | | | | | | | | the number of references on the filesystem root vnode to be both expected and released. Many filesystems hold an extra reference on the filesystem root vnode, which must be accounted for when determining if the filesystem is busy and then released if it isn't busy. The old `skipvp' approach required individual filesystem xxx_unmount functions to re-implement much of vflush()'s logic to deal with the root vnode. All 9 filesystems that hold an extra reference on the root vnode got the logic wrong in the case of forced unmounts, so `umount -f' would always fail if there were any extra root vnode references. Fix this issue centrally in vflush(), now that we can. This commit also fixes a vnode reference leak in devfs, which could result in idle devfs filesystems that refuse to unmount. Reviewed by: phk, bp
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-011-6/+7
| | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations)
* Revert consequences of changes to mount.h, part 2.grog2001-04-291-2/+0
| | | | Requested by: bde
* Correct #includes to work with fixed sys/mount.h.grog2001-04-231-0/+2
|
* o Rather than arbitrarily construct a credential in the nfs_statfs()rwatson2001-04-051-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | VFS operation, make use of the calling process's credential. This solution may not be ideal (there are a number of other possible proposals, including making use of the proc0 credential, adding a credential argument to the VFSOP, and switching from a hard-coded ucred to a hard-coded nfscred), it is simple and appears to work. The arguments against using simply crget() are fairly strong: it is the only place in the code (other than a nearly identical invocation in ncp) where crget() is invoked, other than in the process credential creation code; as ucred becomes extensible, this use of crget() without appropriate context results in less and less meaningful credential data. The implementation here will probably be tweaked as a result of experimentation and further exploration of the requirements. In the mean-time, it allows progress to be made in ucred expansion for new security models without causing a crash every time df is used on an NFS mounted file system. This code has been interop tested against FreeBSD and Solaris NFS servers. While using the process credentials should not introduce interop problems, please let me know if any turn out to exist. Reviewed by: freebsd-arch
* Reviewed by: jlemonadrian2001-03-011-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | An initial tidyup of the mount() syscall and VFS mount code. This code replaces the earlier work done by jlemon in an attempt to make linux_mount() work. * the guts of the mount work has been moved into vfs_mount(). * move `type', `path' and `flags' from being userland variables into being kernel variables in vfs_mount(). `data' remains a pointer into userspace. * Attempt to verify the `type' and `path' strings passed to vfs_mount() aren't too long. * rework mount() and linux_mount() to take the userland parameters (besides data, as mentioned) and pass kernel variables to vfs_mount(). (linux_mount() already did this, I've just tidied it up a little more.) * remove the copyin*() stuff for `path'. `data' still requires copyin*() since its a pointer into userland. * set `mount->mnt_statf_mntonname' in vfs_mount() rather than in each filesystem. This variable is generally initialised with `path', and each filesystem can override it if they want to. * NOTE: f_mntonname is intiailised with "/" in the case of a root mount.
OpenPOWER on IntegriCloud