aboutsummaryrefslogtreecommitdiff
path: root/sys/nfsclient
Commit message (Collapse)AuthorAgeFilesLines
* o Note an additional potential problem here: LOCKD_MSG directly exportsRobert Watson2001-10-241-0/+4
| | | | | | | | | struct ucred to userland. In 5.0-CURRENT, it is desirable to instead export struct xucred, as ucred contains mutexes, pointers, and other kernel evil. I'll add it to my work queue. Notes: svn path=/head/; revision=85398
* o Add two comments identifying problems with the current nfs_lock.cRobert Watson2001-10-231-0/+7
| | | | | | | | | | | | implementation, so that the information doesn't get lost. (1) /var/run/lock is looked up relative to the current thread's root directory, but it's not clear that's desirable. (2) A race condition associated with live credential modification on a shared credential is present when privilege is granted for the purposes of talking to /var/run/lock. Notes: svn path=/head/; revision=85370
* Change the vnode list under the mount point from a LIST to a TAILQMatthew Dillon2001-10-232-4/+4
| | | | | | | | | in preparation for an implementation of limiting code for kern.maxvnodes. MFC after: 3 days Notes: svn path=/head/; revision=85339
* Change the kernel's ucred API as follows:John Baldwin2001-10-112-14/+7
| | | | | | | | | | | - crhold() returns a reference to the ucred whose refcount it bumps. - crcopy() now simply copies the credentials from one credential to another and has no return value. - a new crshared() primitive is added which returns true if a ucred's refcount is > 1 and false (0) otherwise. Notes: svn path=/head/; revision=84827
* Use crhold() instead of crdup() since we aren't modifying the cred butJohn Baldwin2001-10-091-1/+2
| | | | | | | just need to ensure it remains immutable. Notes: svn path=/head/; revision=84726
* Make this compile after last commit. It should be:Peter Wemm2001-10-091-1/+1
| | | | | | | "td ? td->td_proc : NULL", not "td ? td->td_proc, NULL" Notes: svn path=/head/; revision=84700
* Don't dereference td if it's NULL.Julian Elischer2001-10-081-1/+2
| | | | | | | Submitted by: Alexander N. Kabaev <ak03@gte.com> Notes: svn path=/head/; revision=84690
* Unwind some more macros. NFSMADV() was kinda silly since it was rightPeter Wemm2001-09-281-77/+63
| | | | | | | | | | | | | next to equivalent m_len adjustments. Move the nfsm_subs.h macros into groups depending on which phase they are used in, since that affects the error recovery requirements. Collect some of the common error checking into a single macro as preparation for unwinding some more. Have nfs_rephead return a value instead of secretly modifying args. Remove some unused function arguments that were being passed around. Clarify nfsm_reply()'s error handling (I hope). Notes: svn path=/head/; revision=84079
* Make nfsm_dissect() have an obvious return value.Peter Wemm2001-09-274-50/+52
| | | | Notes: svn path=/head/; revision=84057
* Tidy up nfsm_build usage. This is only partially finished.Peter Wemm2001-09-272-38/+38
| | | | Notes: svn path=/head/; revision=84002
* Add a missing dereference level. This caused nfsm_postop_attr_xx()Ian Dowse2001-09-251-1/+1
| | | | | | | | | | to try and extract node attributes from an RPC reply even if none were present. Reviewed by: peter Notes: svn path=/head/; revision=83914
* Add the magic marker so that loader and kldload(2) can find this inPeter Wemm2001-09-201-0/+4
| | | | | | | module form automagically. Notes: svn path=/head/; revision=83697
* Oops. Fix a missing indirection level. gcc didn't complain about it onPeter Wemm2001-09-201-1/+1
| | | | | | | | x86, but did complain about it on alpha (since int and pointer are different sizes) Notes: svn path=/head/; revision=83694
* Sigh, Last minute pre-merge typo. (missing quotes)Peter Wemm2001-09-181-1/+1
| | | | Notes: svn path=/head/; revision=83654
* Cleanup and split of nfs client and server code.Peter Wemm2001-09-1820-7282/+1497
| | | | | | | This builds on the top of several repo-copies. Notes: svn path=/head/; revision=83651
* nfs_strategy calls nfs_asyncio with td as NULL. So add a bandaid thatWarner Losh2001-09-181-1/+1
| | | | | | | | | | | | | will pass NULL as the struct proc when td is NULL. This has stopped crashing on my machine. Note: The passing of NULL may be bogus, but I'll let others fix that problem. Reviewed by: jhb Notes: svn path=/head/; revision=83629
* Sync some differences that were different between the copies of the filesPeter Wemm2001-09-153-9/+9
| | | | | | | that were in nfs/nfs.h and nfsserver/nfs.h in the p4 tree. Notes: svn path=/head/; revision=83493
* KSE Milestone 2Julian Elischer2001-09-1215-481/+490
| | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=83366
* Fix some signed/unsigned integer confusion, and add bounds checking ofKris Kennaway2001-09-103-12/+12
| | | | | | | | | | | arguments to some functions. Obtained from: NetBSD Reviewed by: peter MFC after: 2 weeks Notes: svn path=/head/; revision=83291
* Pushdown Giant for nfs syscalls (nfssvc())Matthew Dillon2001-08-311-12/+23
| | | | Notes: svn path=/head/; revision=82702
* Stupid error from my side in prev. commit: || -> &&Andrey A. Chernov2001-08-231-1/+1
| | | | Notes: svn path=/head/; revision=82213
* Implement l_len<0 per POSIX check.Andrey A. Chernov2001-08-231-4/+6
| | | | | | | Check for valid l_whence too. Notes: svn path=/head/; revision=82204
* Even better move: suppose that server is able to handle SEEK_END,Andrey A. Chernov2001-08-231-6/+6
| | | | | | | | so check arguments for all but not SEEK_END case, leaving SEEK_END handling for server Notes: svn path=/head/; revision=82194
* Apparently SEEK_END locking not supported by NFS. Previous variantAndrey A. Chernov2001-08-231-1/+5
| | | | | | | returns EINVAL in that case, change it to EOPNOTSUPP. Notes: svn path=/head/; revision=82193
* Move <machine/*> after <sys/*>Andrey A. Chernov2001-08-231-1/+2
| | | | | | | Pointed by: bde Notes: svn path=/head/; revision=82190
* adv. lock:Andrey A. Chernov2001-08-231-5/+5
| | | | | | | | detect off_t overflow _before_ it occurse and return EOVERFLOW instead of EINVAL Notes: svn path=/head/; revision=82174
* Fix a client-side memory leak in nfs_flush(). The code allocatesIan Dowse2001-08-011-2/+2
| | | | | | | | | | | | | | | | a temporary array to store struct buf pointers if the list doesn't fit in a local array. Usually it frees the array when finished, but if it jumps to the 'again' label and the new list does fit in the local array then it can forget to free a previously malloc'd M_TEMP memory. Move the free() up a line so that it frees any previously allocated memory whether or not it needs to malloc a new array. Reviewed by: dillon Notes: svn path=/head/; revision=80891
* Check the filehandle size when mounting.Peter Wemm2001-07-301-0/+2
| | | | | | | Obtained from: Constantine Sapuntzakis <csapuntz@openbsd.org> Notes: svn path=/head/; revision=80672
* - Sort includes.John Baldwin2001-07-041-5/+10
| | | | | | | - Update vmmeter statistics for vnode pagein/pageouts in getpages/putpages. Notes: svn path=/head/; revision=79247
* With Alfred's permission, remove vm_mtx in favor of a fine-grained approachMatthew Dillon2001-07-042-16/+10
| | | | | | | | | | | | (this commit is just the first stage). Also add various GIANT_ macros to formalize the removal of Giant, making it easy to test in a more piecemeal fashion. These macros will allow us to test fine-grained locks to a degree before removing Giant, and also after, and to remove Giant in a piecemeal fashion via sysctl's on those subsystems which the authors believe can operate without Giant. Notes: svn path=/head/; revision=79224
* - Protect the mnt_vnode list with the mntvnode lock.John Baldwin2001-06-282-7/+20
| | | | | | | - Use queue(9) macros. Notes: svn path=/head/; revision=78911
* Unlock the process returned from pfind() if it does not return NULL.Jake Burkholder2001-06-011-1/+4
| | | | | | | | | | | This fixes a witness lock violation for nfssvc returning with locks held. Submitted by: Jean-Luc Richier <Jean-Luc.Richier@imag.fr> PR: kern/27776 Notes: svn path=/head/; revision=77563
* o Merge contents of struct pcred into struct ucred. Specifically, add theRobert Watson2001-05-251-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | real uid, saved uid, real gid, and saved gid to ucred, as well as the pcred->pc_uidinfo, which was associated with the real uid, only rename it to cr_ruidinfo so as not to conflict with cr_uidinfo, which corresponds to the effective uid. o Remove p_cred from struct proc; add p_ucred to struct proc, replacing original macro that pointed. p->p_ucred to p->p_cred->pc_ucred. o Universally update code so that it makes use of ucred instead of pcred, p->p_ucred instead of p->p_pcred, cr_ruidinfo instead of p_uidinfo, cr_{r,sv}{u,g}id instead of p_*, etc. o Remove pcred0 and its initialization from init_main.c; initialize cr_ruidinfo there. o Restruction many credential modification chunks to always crdup while we figure out locking and optimizations; generally speaking, this means moving to a structure like this: newcred = crdup(oldcred); ... p->p_ucred = newcred; crfree(oldcred); It's not race-free, but better than nothing. There are also races in sys_process.c, all inter-process authorization, fork, exec, and exit. o Remove sigio->sio_ruid since sigio->sio_ucred now contains the ruid; remove comments indicating that the old arrangement was a problem. o Restructure exec1() a little to use newcred/oldcred arrangement, and use improved uid management primitives. o Clean up exit1() so as to do less work in credential cleanup due to pcred removal. o Clean up fork1() so as to do less work in credential cleanup and allocation. o Clean up ktrcanset() to take into account changes, and move to using suser_xxx() instead of performing a direct uid==0 comparision. o Improve commenting in various kern_prot.c credential modification calls to better document current behavior. In a couple of places, current behavior is a little questionable and we need to check POSIX.1 to make sure it's "right". More commenting work still remains to be done. o Update credential management calls, such as crfree(), to take into account new ruidinfo reference. o Modify or add the following uid and gid helper routines: change_euid() change_egid() change_ruid() change_rgid() change_svuid() change_svgid() In each case, the call now acts on a credential not a process, and as such no longer requires more complicated process locking/etc. They now assume the caller will do any necessary allocation of an exclusive credential reference. Each is commented to document its reference requirements. o CANSIGIO() is simplified to require only credentials, not processes and pcreds. o Remove lots of (p_pcred==NULL) checks. o Add an XXX to authorization code in nfs_lock.c, since it's questionable, and needs to be considered carefully. o Simplify posix4 authorization code to require only credentials, not processes and pcreds. Note that this authorization, as well as CANSIGIO(), needs to be updated to use the p_cansignal() and p_cansched() centralized authorization routines, as they currently do not take into account some desirable restrictions that are handled by the centralized routines, as well as being inconsistent with other similar authorization instances. o Update libkvm to take these changes into account. Obtained from: TrustedBSD Project Reviewed by: green, bde, jhb, freebsd-arch, freebsd-audit Notes: svn path=/head/; revision=77183
* Assert Giant is held by the caller rather than getting it and releasingJohn Baldwin2001-05-231-10/+2
| | | | | | | it in getpages/putpages. Notes: svn path=/head/; revision=77086
* - FDESC, FIFO, NULL, PORTAL, PROC, UMAP and UNION fileRuslan Ermilov2001-05-231-1/+1
| | | | | | | | | | | | | | | | | | systems were repo-copied from sys/miscfs to sys/fs. - Renamed the following file systems and their modules: fdesc -> fdescfs, portal -> portalfs, union -> unionfs. - Renamed corresponding kernel options: FDESC -> FDESCFS, PORTAL -> PORTALFS, UNION -> UNIONFS. - Install header files for the above file systems. - Removed bogus -I${.CURDIR}/../../sys CFLAGS from userland Makefiles. Notes: svn path=/head/; revision=77031
* Introduce a global lock for the vm subsystem (vm_mtx).Alfred Perlstein2001-05-192-3/+30
| | | | | | | | | | | | | | | | | | | | | | vm_mtx does not recurse and is required for most low level vm operations. faults can not be taken without holding Giant. Memory subsystems can now call the base page allocators safely. Almost all atomic ops were removed as they are covered under the vm mutex. Alpha and ia64 now need to catch up to i386's trap handlers. FFS and NFS have been tested, other filesystems will need minor changes (grabbing the vm lock when twiddling page properties). Reviewed (partially) by: jake, jhb Notes: svn path=/head/; revision=76827
* Change the second argument of vflush() to an integer that specifiesIan Dowse2001-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 Notes: svn path=/head/; revision=76688
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inMark Murray2001-05-014-18/+26
| | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=76166
* Add a vop_stdbmap(), and make it part of the default vop vector.Poul-Henning Kamp2001-04-291-35/+0
| | | | | | | | | Make 7 filesystems which don't really know about VOP_BMAP rely on the default vector, rather than more or less complete local vop_nopbmap() implementations. Notes: svn path=/head/; revision=76131
* Remove incorrect comment.Alfred Perlstein2001-04-291-1/+0
| | | | | | | | Submitted by: quinot@inf.enst.fr <quinot@inf.enst.fr> PR: kern/26893 Notes: svn path=/head/; revision=76118
* Revert consequences of changes to mount.h, part 2.Greg Lehey2001-04-298-16/+0
| | | | | | | Requested by: bde Notes: svn path=/head/; revision=76117
* Correct #includes to work with fixed sys/mount.h.Greg Lehey2001-04-238-0/+16
| | | | Notes: svn path=/head/; revision=75858
* vnode_pager_freepage() is really vm_page_free() in disguise,Alfred Perlstein2001-04-191-3/+3
| | | | | | | nuke vnode_pager_freepage() and replace all calls to it with vm_page_free() Notes: svn path=/head/; revision=75692
* Implement client side NFS locks.Alfred Perlstein2001-04-178-7/+440
| | | | | | | | Obtained from: BSD/os Import Ok'd by: mckusick, jkh, motd on builder.freebsd.org Notes: svn path=/head/; revision=75631
* This patch removes the VOP_BWRITE() vector.Poul-Henning Kamp2001-04-172-19/+23
| | | | | | | | | | | | | | | | VOP_BWRITE() was a hack which made it possible for NFS client side to use struct buf with non-bio backing. This patch takes a more general approach and adds a bp->b_op vector where more methods can be added. The success of this patch depends on bp->b_op being initialized all relevant places for some value of "relevant" which is not easy to determine. For now the buffers have grown a b_magic element which will make such issues a tiny bit easier to debug. Notes: svn path=/head/; revision=75580
* Create debug.hashstat.[raw]nchash and debug.hashstat.[raw]nfsnode toPeter Wemm2001-04-111-0/+79
| | | | | | | | | | | | | | enable easy access to the hash chain stats. The raw prefixed versions dump an integer array to userland with the chain lengths. This cheats and calls it an array of 'struct int' rather than 'int' or sysctl -a faithfully dumps out the 128K array on an average machine. The non-raw versions return 4 integers: count, number of chains used, maximum chain length, and percentage utilization (fixed point, multiplied by 100). The raw forms are more useful for analyzing the hash distribution, while the other form can be read easily by humans and stats loggers. Notes: svn path=/head/; revision=75402
* o Rather than arbitrarily construct a credential in the nfs_statfs()Robert Watson2001-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 Notes: svn path=/head/; revision=75218
* Use the same API as the example code.Peter Wemm2001-03-201-1/+1
| | | | | | | | | | | | | Allow the initial hash value to be passed in, as the examples do. Incrementally hash in the dvp->v_id (using the official api) rather than add it. This seems to help power-of-two predictable filename trees where the filenames repeat on a power-of-two cycle and the directory trees have power-of-two components in it. The simple add then mask was causing things like 12000+ entry collision chains while most other entries have between 0 and 3 entries each. This way seems to improve things. Notes: svn path=/head/; revision=74501
* Use a generic implementation of the Fowler/Noll/Vo hash (FNV hash).Peter Wemm2001-03-174-31/+2
| | | | | | | | | | | | | | | | | | | | Make the name cache hash as well as the nfsnode hash use it. As a special tweak, create an unsigned version of register_t. This allows us to use a special tweak for the 64 bit versions that significantly speeds up the i386 version (ie: int64 XOR int64 is slower than int64 XOR int32). The code layout is a little strange for the string function, but I was able to get between 5 to 10% improvement over the original version I started with. The layout affects gcc code generation choices and this way was fastest on x86 and alpha. Note that 'CPUTYPE=p3' etc makes a fair difference to this. It is around 45% faster with -march=pentiumpro on a p6 cpu. Notes: svn path=/head/; revision=74384
* Dramatically improve the **lame** nfs_hash(). This is based on thePeter Wemm2001-03-171-8/+16
| | | | | | | | | | | | | | | | Fowler / Noll / Vo Hash (http://www.isthe.com/chongo/tech/comp/fnv/). This improves hash coverage a *massive* amount. We were seeing one set of machines that were using 0.84% of their 131072 entry nfsnode hash buckets with maximum chain lengths of up to ~500 entries. The machine was spending nearly 100% of its time in 'system'. A test with this has pushed the coverage from a few perCent up to 91% utilization with a max chain length of 11. Submitted by: David Filo Notes: svn path=/head/; revision=74381