summaryrefslogtreecommitdiffstats
path: root/sys/nfs
Commit message (Collapse)AuthorAgeFilesLines
* Divorce "dev_t" from the "major|minor" bitmap, which is now calledphk1999-05-114-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | udev_t in the kernel but still called dev_t in userland. Provide functions to manipulate both types: major() umajor() minor() uminor() makedev() umakedev() dev2udev() udev2dev() For now they're functions, they will become in-line functions after one of the next two steps in this process. Return major/minor/makedev to macro-hood for userland. Register a name in cdevsw[] for the "filedescriptor" driver. In the kernel the udev_t appears in places where we have the major/minor number combination, (ie: a potential device: we may not have the driver nor the device), like in inodes, vattr, cdevsw registration and so on, whereas the dev_t appears where we carry around a reference to a actual device. In the future the cdevsw and the aliased-from vnode will be hung directly from the dev_t, along with up to two softc pointers for the device driver and a few houskeeping bits. This will essentially replace the current "alias" check code (same buck, bigger bang). A little stunt has been provided to try to catch places where the wrong type is being used (dev_t vs udev_t), if you see something not working, #undef DEVT_FASCIST in kern/kern_conf.c and see if it makes a difference. If it does, please try to track it down (many hands make light work) or at least try to reproduce it as simply as possible, and describe how to do that. Without DEVT_FASCIST I belive this patch is a no-op. Stylistic/posixoid comments about the userland view of the <sys/*.h> files welcome now, from userland they now contain the end result. Next planned step: make all dev_t's refer to the same devsw[] which means convert BLK's to CHR's at the perimeter of the vnodes and other places where they enter the game (bootdev, mknod, sysctl).
* remove b_proc from struct buf, it's (now) unused.phk1999-05-063-17/+16
| | | | Reviewed by: dillon, bde
* Add sufficient braces to keep egcs happy about potentially ambiguouspeter1999-05-062-4/+6
| | | | if/else nesting.
* All directory accesses must be made with NFS_DIRBLKSIZE chunks to avoidalc1999-05-031-3/+3
| | | | | | | | | | confusing the directory read cookie cache. The nfs_access implementation for v2 mounts attempts to read from the directory if root is the user so that root can't access cached files when the server remaps root to some other user. Submitted by: Doug Rabson <dfr@nlsystems.com> Reviewed by: Matthew Dillon <dillon@apollo.backplane.com>
* The VFS/BIO subsystem contained a number of hacks in order to optimizealc1999-05-025-277/+321
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | piecemeal, middle-of-file writes for NFS. These hacks have caused no end of trouble, especially when combined with mmap(). I've removed them. Instead, NFS will issue a read-before-write to fully instantiate the struct buf containing the write. NFS does, however, optimize piecemeal appends to files. For most common file operations, you will not notice the difference. The sole remaining fragment in the VFS/BIO system is b_dirtyoff/end, which NFS uses to avoid cache coherency issues with read-merge-write style operations. NFS also optimizes the write-covers-entire-buffer case by avoiding the read-before-write. There is quite a bit of room for further optimization in these areas. The VM system marks pages fully-valid (AKA vm_page_t->valid = VM_PAGE_BITS_ALL) in several places, most noteably in vm_fault. This is not correct operation. The vm_pager_get_pages() code is now responsible for marking VM pages all-valid. A number of VM helper routines have been added to aid in zeroing-out the invalid portions of a VM page prior to the page being marked all-valid. This operation is necessary to properly support mmap(). The zeroing occurs most often when dealing with file-EOF situations. Several bugs have been fixed in the NFS subsystem, including bits handling file and directory EOF situations and buf->b_flags consistancy issues relating to clearing B_ERROR & B_INVAL, and handling B_DONE. getblk() and allocbuf() have been rewritten. B_CACHE operation is now formally defined in comments and more straightforward in implementation. B_CACHE for VMIO buffers is based on the validity of the backing store. B_CACHE for non-VMIO buffers is based simply on whether the buffer is B_INVAL or not (B_CACHE set if B_INVAL clear, and vise-versa). biodone() is now responsible for setting B_CACHE when a successful read completes. B_CACHE is also set when a bdwrite() is initiated and when a bwrite() is initiated. VFS VOP_BWRITE routines (there are only two - nfs_bwrite() and bwrite()) are now expected to set B_CACHE. This means that bowrite() and bawrite() also set B_CACHE indirectly. There are a number of places in the code which were previously using buf->b_bufsize (which is DEV_BSIZE aligned) when they should have been using buf->b_bcount. These have been fixed. getblk() now clears B_DONE on return because the rest of the system is so bad about dealing with B_DONE. Major fixes to NFS/TCP have been made. A server-side bug could cause requests to be lost by the server due to nfs_realign() overwriting other rpc's in the same TCP mbuf chain. The server's kernel must be recompiled to get the benefit of the fixes. Submitted by: Matthew Dillon <dillon@apollo.backplane.com>
* This Implements the mumbled about "Jail" feature.phk1999-04-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a seriously beefed up chroot kind of thing. The process is jailed along the same lines as a chroot does it, but with additional tough restrictions imposed on what the superuser can do. For all I know, it is safe to hand over the root bit inside a prison to the customer living in that prison, this is what it was developed for in fact: "real virtual servers". Each prison has an ip number associated with it, which all IP communications will be coerced to use and each prison has its own hostname. Needless to say, you need more RAM this way, but the advantage is that each customer can run their own particular version of apache and not stomp on the toes of their neighbors. It generally does what one would expect, but setting up a jail still takes a little knowledge. A few notes: I have no scripts for setting up a jail, don't ask me for them. The IP number should be an alias on one of the interfaces. mount a /proc in each jail, it will make ps more useable. /proc/<pid>/status tells the hostname of the prison for jailed processes. Quotas are only sensible if you have a mountpoint per prison. There are no privisions for stopping resource-hogging. Some "#ifdef INET" and similar may be missing (send patches!) If somebody wants to take it from here and develop it into more of a "virtual machine" they should be most welcome! Tools, comments, patches & documentation most welcome. Have fun... Sponsored by: http://www.rndassociates.com/ Run for almost a year by: http://www.servetheweb.com/
* Suser() simplification:phk1999-04-272-6/+6
| | | | | | | | | | | | | | | | | | | 1: s/suser/suser_xxx/ 2: Add new function: suser(struct proc *), prototyped in <sys/proc.h>. 3: s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/ The remaining suser_xxx() calls will be scrutinized and dealt with later. There may be some unneeded #include <sys/cred.h>, but they are left as an exercise for Bruce. More changes to the suser() API will come along with the "jail" code.
* Fixed printf format errors on alpha.dt1999-04-241-3/+3
|
* Close a potential mbuf and/or mbuf cluster leak in the client-side NFSpeter1999-04-101-2/+2
| | | | statfs() code. Free the whole chain, not just the first one.
* Hold nfsd's upages in-core with PHOLD rather than P_NOSWAP.peter1999-04-061-2/+2
|
* Catch a case spotted by Tor where files mmapped could leave garbage in thejulian1999-04-051-10/+46
| | | | | | | | | | | | unallocated parts of the last page when the file ended on a frag but not a page boundary. Delimitted by tags PRE_MATT_MMAP_EOF and POST_MATT_MMAP_EOF, in files alpha/alpha/pmap.c i386/i386/pmap.c nfs/nfs_bio.c vm/pmap.h vm/vm_page.c vm/vm_page.h vm/vnode_pager.c miscfs/specfs/spec_vnops.c ufs/ufs/ufs_readwrite.c kern/vfs_bio.c Submitted by: Matt Dillon <dillon@freebsd.org> Reviewed by: Alan Cox <alc@freebsd.org>
* Reviewed by: Many at differnt times in differnt parts,julian1999-03-122-51/+87
| | | | | | | | | | | | | | | | | | | | | | including alan, john, me, luoqi, and kirk Submitted by: Matt Dillon <dillon@frebsd.org> This change implements a relatively sophisticated fix to getnewbuf(). There were two problems with getnewbuf(). First, the writerecursion can lead to a system stack overflow when you have NFS and/or VN devices in the system. Second, the free/dirty buffer accounting was completely broken. Not only did the nfs routines blow it trying to manually account for the buffer state, but the accounting that was done did not work well with the purpose of their existance: figuring out when getnewbuf() needs to sleep. The meat of the change is to kern/vfs_bio.c. The remaining diffs are all minor except for NFS, which includes both the fixes for bp interaction AND fixes for a 'biodone(): buffer already done' lockup. Sys/buf.h also contains a chaining structure which is not used by this patchset but is used by other patches that are coming soon. This patch deliniated by tags PRE_MAT_GETBUF and POST_MAT_GETBUF. (sorry for the missing T matt)
* Untangle the nfs send and receive queue locking a little. One lockpeter1999-02-254-72/+93
| | | | | | routine was [ab]used for two different things, and you couldn't tell from the wait channel which one had wedged. Catch a few things missing from NFS_NOSERVER.
* Move the declaration of the vfs.nfs sysctl node outside an ifdef so thatdfr1999-02-181-3/+3
| | | | | | it builds if NFS_NOSERVER is defined. Spotted by: Bruce Evans <bde@zeta.org.au>
* Fixed bitrot in NFS_ACDEBUG option.bde1999-02-172-2/+4
|
* * Change sysctl from using linker_set to construct its tree using SLISTs.dfr1999-02-164-5/+10
| | | | | | | | | | This makes it possible to change the sysctl tree at runtime. * Change KLD to find and register any sysctl nodes contained in the loaded file and to unregister them when the file is unloaded. Reviewed by: Archie Cobbs <archie@whistle.com>, Peter Wemm <peter@netplex.com.au> (well they looked at it anyway)
* General additional cleanup of VOP API for NFS ops - mainly NFS ignoringdillon1999-02-131-4/+13
| | | | | | | | the API for freeing up cnp's. This cleanup should not effect nominal operation one way or the other since NFS VOPs just happen to be called with flags that match what it actually does to the NAMEI components it gets. Still, if an NFS error occured, there was probably some memory leakage of NAMEI components with certain NFS VOP ops.
* PR: kern/9970dillon1999-02-131-2/+1
| | | | Remove incorrect vput() in nfs_link()
* Flush delayed-write data out prior to issuing a rename rpc. This appearsdillon1999-02-061-1/+14
| | | | | | to fix the problem w/ NFSV3 whereby a make installworld would get into high-network-bandwidth situations continuously trying to retry nfs writes that fail with a 'stale file handle' error.
* Fix warnings related to -Wall -Wcast-qualdillon1999-01-281-3/+3
|
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-281-8/+8
| | | | kernel compile
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-272-6/+6
| | | | | | | kernel compile. This commit includes significant work to proper handle const arguments for the DDB symbol routines.
* Fix nasty bug in nfs_access(). A conditional was if (a = b) instead ofdillon1999-01-271-2/+2
| | | | if (a == b).
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-271-6/+6
| | | | kernel compile
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-273-8/+8
| | | | kernel compile
* This is a rather large commit that encompasses the new swapper,dillon1999-01-214-14/+39
| | | | | | | | | | changes to the VM system to support the new swapper, VM bug fixes, several VM optimizations, and some additional revamping of the VM code. The specific bug fixes will be documented with additional forced commits. This commit is somewhat rough in regards to code cleanup issues. Reviewed by: "John S. Dyson" <root@dyson.iquest.net>, "David Greenman" <dg@root.com>
* Remove two cases of unused variable sp3.eivind1999-01-121-3/+1
|
* Remove the 'waslocked' parameter to vfs_object_create().eivind1999-01-052-4/+4
|
* Silence -Wtrigraph.hoek1998-12-301-4/+4
| | | | Submitted by: Bradley Dunn <bradley@dunn.org> (pr: kern/8817)
* Fix for creating files on a Solaris 7 server with NFSv3 (the request wasdfr1998-12-253-101/+139
| | | | | | slightly garbled but older servers seemed to understand it). Reviewed by: David O'Brien <obrien@nuxi.ucdavis.edu>
* Added 3 new errno values, requred by various standards: EOVERFLOW,dt1998-12-142-4/+6
| | | | | | | ECANCELED, EILSEQ. Fixed ibcs2 and especially linux EIDRM and ENOMSG errno mapping. Reviewed by: Dan Nelson <dnelson@emsphone.com>
* (Hopefully) fix support for "large" files. Mostly cast block numbers to off_tdt1998-12-141-13/+13
| | | | before they multiplied to block sizes.
* Remove the if fixed in the last commit; bde quite correctly point outeivind1998-12-091-3/+2
| | | | that it can never fail.
* Fix typo (; in "if (vp == NULL);").eivind1998-12-081-2/+2
|
* The "easy" fixes for compiling the kernel -Wunused: remove unreferenced staticarchie1998-12-076-16/+7
| | | | and local variables, goto labels, and functions declared but not defined.
* Examine all occurrences of sprintf(), strcat(), and str[n]cpy()archie1998-12-042-6/+7
| | | | | | | | | | | | | | for possible buffer overflow problems. Replaced most sprintf()'s with snprintf(); for others cases, added terminating NUL bytes where appropriate, replaced constants like "16" with sizeof(), etc. These changes include several bug fixes, but most changes are for maintainability's sake. Any instance where it wasn't "immediately obvious" that a buffer overflow could not occur was made safer. Reviewed by: Bruce Evans <bde@zeta.org.au> Reviewed by: Matthew Dillon <dillon@apollo.backplane.com> Reviewed by: Mike Spengler <mks@networkcs.com>
* Make bootp error message slightly more verbosedillon1998-12-031-2/+2
|
* Reimplement the NFS ACCESS RPC cache as an "accelerator" rather than a truemsmith1998-11-152-44/+14
| | | | | | | | | | | | | | | | | | | | cache. If the cached result lets us say "yes", then go with that. If we're not sure, or we think the answer might be "no", go to the wire to be certain. This avoids all of the possible false veto cases, and allows us to key the cached value with just the UID for which the cached value holds, reducing the bloat of the nfsnode structure from 104 bytes to just 12 bytes. Since the "yes" case is by far the most common, this should still provide a substantial performance improvement. Also default the cache to on, with a conservative timeout (2 seconds). This improves performance if NFS is loaded as a KLD module, as there's not (yet) code to parse an option out of the module arguments to set it, and sysctl doesn't work (yet) for OIDs in modules. The 'accelerator' mode was suggested by Bjoern Groenvall (bg@sics.se) Feedback on this would be appreciated as testing has been necessarily limited by Comdex, and it would be valuable to have this in 2.2.8.
* Avoid a null pointer reference if the target of an NFS rename has beenmsmith1998-11-131-7/+10
| | | | | | sillrenamed, or if the source vnode doesn't have an associated nfsnode. Bug report from Andrew Gallatin <gallatin@cs.duke.edu>
* Fix a panic in nfsrv_dorec() where a NULL pointer could be passed todfr1998-11-131-2/+4
| | | | | | free() sometimes. Reviewed by: Eric Haug <ejh@eas.slu.edu>
* Implement NFS ACCESS RPC result caching.msmith1998-11-132-24/+98
| | | | | | | | | | | | | | | | | | This yields startling performance increases for NFS clients for many access profiles, due to the fact that ACCESS results are persistently cached in the namecache in many cases. Note that the code is somewhat conservative in that it requires an exact credential match for a cache hit. This bloats the nfsnode structure by sizeof(struct ucred) (96 bytes). Any less conservative approach opens the possibility for a false veto in eg. setuid applications. Alternative suggestions would be welcomed. The cache is normally disabled, to activate set the sysctl variable vfs.nfs.access_cache_timeout to a nonzero value. This is the time in seconds that a cached entry will be considered valid; useful values appear to be 2-10 seconds. Performance of the cache can be monitored with the vfs.nfs.access_cache_hits and vfs.nfs.access_cache_hits variables.
* Remove [apparently] bogus casts to u_long for the vnode_pager_setsize()peter1998-11-094-12/+12
| | | | | | | second argument. np_size is a 64 bit int, so is the second arg. This might have caused needless 2G/4G file size problems. I believe it was Bruce who queried this.
* vm_object_page_clean() last arg changed from TRUE to OBJPC_SYNC. I'm notpeter1998-10-311-2/+2
| | | | | | sure that this is necessary to be a sync write here since a VOP_FSYNC() follows and it will schedule, sort and complete the writes that the vm_object_page_clean() started (as I think I understand things).
* Use TAILQ macros for clean/dirty block list processing. Set b_xflagspeter1998-10-315-18/+19
| | | | rather than abusing the list next pointer with a magic number.
* In nfs_link(), check for a cross-device mount *before* lookingmckusick1998-09-291-2/+3
| | | | | in the v_data field. Obtained from: Charles Hannum, via Frank van der Linden <frank@wins.uva.nl>
* Missing vput when cross-device link error is detected in nfs_link.mckusick1998-09-291-0/+1
|
* During truncation, have to notify the VM about the new sizemckusick1998-09-291-3/+5
| | | | | of the NFS file *before* doing the nfs_vinvalbuf operation. Otherwise some invalid data may show up in an mmap.
* Frank sez: 'It fixes a problem with servers that return 0 valuesmckusick1998-09-291-7/+10
| | | | | | | | for some of the fsinfo RPC fields. It is strictly speaking not wrong to do this, as the spec says that "it is expected that a server will make a best effort at supporting all the attributes", but pretty unusual. You guessed it, it's NT servers that do it.' Obtained from: Frank van der Linden <frank@wins.uva.nl>
* Do not need (or want) to take a reference on an NFS file thatmckusick1998-09-291-6/+12
| | | | | | | | | is being deleted due to an forcible unmount. The problem is that vgone calls vclean() which then calls calls nfs_inactive() with VXLOCK set on the vnode. Nfs_inactive() was calling vget() to get a reference on the vnode, which in turn hung on VXLOCK. Nfs_inactive() now checks v_usecount to make sure that the vnode is not coming from vclean() before it does a vget().
* The code checks each fragment mark to see if it's valid; if the fragmentmckusick1998-09-291-2/+2
| | | | | | | | | | | | | | | | | | | | | is less than NFS_MINPACKET or greater than NFS_MAXPACKET in size, it barfs and, I think, drops the connection. However, there's no guarantee that in a multi-fragment RPC, all the fragments will be at least as large as NFS_MINPACKET. In fact, with the version of "tclnfs" we have here, which supports NFS over TCP, at least when built under SunOS 4.1.3 (i.e., with 4.1.3's user-mode ONC RPC library), I can *repeatably* cause "tclnfs" to send a request with more than one fragment, one of which is only 8 bytes long. I just do a 3877-byte write to a file, at an offset of 0. The check that "slp->ns_reclen" is greater than or equal to NFS_MINPACKET serves no useful purpose - if the NFS server code can't handle packets < NFS_MINPACKET bytes, it can't handle them over *any* protocol, so the check has to be done above the RPC-over-TCP layer - and should be removed. Obtained from: Fix from Guy Harris, forwarded by Rick Macklem.
OpenPOWER on IntegriCloud