aboutsummaryrefslogtreecommitdiff
path: root/sys/nfsserver/nfs_srvsubs.c
Commit message (Collapse)AuthorAgeFilesLines
* Use TAILQ macros for clean/dirty block list processing. Set b_xflagsPeter Wemm1998-10-311-3/+3
| | | | | | | rather than abusing the list next pointer with a magic number. Notes: svn path=/head/; revision=40790
* Made unloading of the nfs LKM sort of work. This is mainly to testBruce Evans1998-09-071-3/+36
| | | | | | | | | detachment of vfs sysctls. Unloading of vfs LKMs doesn't actually work for any vfs, since it leaves garbage pointers to memory allocation control structures. Notes: svn path=/head/; revision=38894
* Instantiate `nfs_mount_type' in a standard file so that it is presentBruce Evans1998-09-051-2/+1
| | | | | | | | | | | when nfs is an LKM. Declare it in a header file. Don't forget to use it in non-Lite2 code. Initialize it to -1 instead of to 0, since 0 will soon be the mount type number for the first vfs loaded. NetBSD uses strcmp() to avoid this ugly global. Notes: svn path=/head/; revision=38866
* Fixed typo in ifdefed code. (NFS_ACDEBUG is not in LINT. Therefore,Bruce Evans1998-06-211-2/+2
| | | | | | | code controlled by it did not even compile.) Notes: svn path=/head/; revision=37089
* Avoid an egcs pessimization for 64-bit signed division on i386's.Bruce Evans1998-06-141-4/+4
| | | | | | | | | | | | Pre-2.8 versions of gcc generate a call to __divdi3() for all 64-bit signed divisions, but egcs optimizes them to a shift and fixup when the divisor is a constant power of 2. Unfortunately, it generates a call to __cmpdi2() for the fixup, although all except possibly ancient versions of gcc and egcs do ordinary 64-bit comparisons inline. Notes: svn path=/head/; revision=36979
* For the on-the-wire protocol, u_long -> u_int32_t; long -> int32_t;Peter Wemm1998-05-311-32/+35
| | | | | | | | | | int -> int32_t; u_short -> u_int16_t. Also, use mode_t instead of u_short for storing modes (mode_t is a u_int16_t). Obtained from: NetBSD Notes: svn path=/head/; revision=36541
* Prototype support for selectively allowing non-reserved ports on a perPeter Wemm1998-05-311-1/+14
| | | | | | | | | export basis. Needs userland support yet. Obtained from: NetBSD Notes: svn path=/head/; revision=36534
* #ifdef a diagnostic panic, plus another missed costmetic change.Peter Wemm1998-05-311-2/+4
| | | | | | | Obtained from: NetBSD Notes: svn path=/head/; revision=36519
* We have gained 2 more errno's, add them to the NFSv2 mapping table.Peter Wemm1998-05-311-2/+2
| | | | Notes: svn path=/head/; revision=36518
* Some const'sPeter Wemm1998-05-311-2/+2
| | | | | | | Obtained from: NetBSD Notes: svn path=/head/; revision=36511
* NFS Jumbo commit part 1. Cosmetic and structural changes only. The aimPeter Wemm1998-05-311-2/+43
| | | | | | | | | of this part of commits is to minimize unnecessary differences between the other NFS's of similar origin. Yes, there are gratuitous changes here that the style folks won't like, but it makes the catch-up less difficult. Notes: svn path=/head/; revision=36503
* Convert a couple of large allocations to use zones rather than mallocPeter Wemm1998-05-241-9/+3
| | | | | | | | | for better packing. This means that we can choose better values for the various hash entries without having to try and get it all to fit within an artificial power of two limit for malloc's sake. Notes: svn path=/head/; revision=36329
* Allow control of the attribute cache timeouts at mount time.Peter Wemm1998-05-191-4/+45
| | | | | | | | | We had run out of bits in the nfs mount flags, I have moved the internal state flags into a seperate variable. These are no longer visible via statfs(), but I don't know of anything that looks at them. Notes: svn path=/head/; revision=36176
* Use random() to find our initial xid.Poul-Henning Kamp1998-04-061-11/+4
| | | | Notes: svn path=/head/; revision=35066
* Eradicate the variable "time" from the kernel, using various measures.Poul-Henning Kamp1998-03-301-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "time" wasn't a atomic variable, so splfoo() protection were needed around any access to it, unless you just wanted the seconds part. Most uses of time.tv_sec now uses the new variable time_second instead. gettime() changed to getmicrotime(0. Remove a couple of unneeded splfoo() protections, the new getmicrotime() is atomic, (until Bruce sets a breakpoint in it). A couple of places needed random data, so use read_random() instead of mucking about with time which isn't random. Add a new nfs_curusec() function. Mark a couple of bogosities involving the now disappeard time variable. Update ffs_update() to avoid the weird "== &time" checks, by fixing the one remaining call that passwd &time as args. Change profiling in ncr.c to use ticks instead of time. Resolution is the same. Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call hzto() which subtracts time" sequences. Reviewed by: bde Notes: svn path=/head/; revision=34961
* Back out DIAGNOSTIC changes.Eivind Eklund1998-02-061-4/+1
| | | | Notes: svn path=/head/; revision=33134
* Turn DIAGNOSTIC into a new-style option.Eivind Eklund1998-02-041-1/+4
| | | | Notes: svn path=/head/; revision=33108
* Unspammed nested include of <vm/vm_zone.h>.Bruce Evans1997-12-271-1/+2
| | | | Notes: svn path=/head/; revision=32011
* Added a used include.Bruce Evans1997-12-201-6/+9
| | | | | | | Fixed a gratuitous ANSIism and nearby KNF violations. Notes: svn path=/head/; revision=31886
* Remove a bunch of variables which were unused both in GENERIC and LINT.Poul-Henning Kamp1997-11-071-2/+1
| | | | | | | Found by: -Wunused Notes: svn path=/head/; revision=31016
* Removed unused #includes.Bruce Evans1997-10-281-4/+1
| | | | Notes: svn path=/head/; revision=30813
* Don't #include <nfs/nfs.h> in <nfs/nfs_node.h> if KERNEL is defined.Bruce Evans1997-10-281-2/+2
| | | | | | | Fixed everything that depended on the nested include. Notes: svn path=/head/; revision=30808
* Always initialize the syscall vectors for our "private" syscalls (notPoul-Henning Kamp1997-10-261-10/+4
| | | | | | | | just in the LKM case). Plug nqnfs_vop_lease_check directly into the default_vnodeop_p table. Notes: svn path=/head/; revision=30738
* Change the M_NAMEI allocations to use the zone allocator. This changeJohn Dyson1997-09-211-10/+11
| | | | | | | | | | | plus the previous changes to use the zone allocator decrease the useage of malloc by half. The Zone allocator will be upgradeable to be able to use per CPU-pools, and has more intelligent usage of SPLs. Additionally, it has reasonable stats gathering capabilities, while making most calls inline. Notes: svn path=/head/; revision=29653
* unifdef -U__NetBSD__ -D__FreeBSD__Poul-Henning Kamp1997-09-101-9/+1
| | | | Notes: svn path=/head/; revision=29288
* Fix all areas of the system (or at least all those in LINT) to avoid storingGarrett Wollman1997-08-161-7/+7
| | | | | | | | | | | socket addresses in mbufs. (Socket buffers are the one exception.) A number of kernel APIs needed to get fixed in order to make this happen. Also, fix three protocol families which kept PCBs in mbufs to not malloc them instead. Delete some old compatibility cruft while we're at it, and add some new routines in the in_cksum family. Notes: svn path=/head/; revision=28270
* Correct some dumb mistakes in the WebNFS stuff.Doug Rabson1997-07-221-8/+16
| | | | | | | Submitted by: bde Notes: svn path=/head/; revision=27609
* Merge WebNFS changes from NetBSD.Doug Rabson1997-07-161-34/+187
| | | | | | | Obtained from: NetBSD Notes: svn path=/head/; revision=27446
* Fix various bugs in the locking protocol, allowing proper shared locksDoug Rabson1997-04-041-9/+1
| | | | | | | to be used. This should fix the lock panics that people are seeing. Notes: svn path=/head/; revision=24626
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notPeter Wemm1997-02-221-1/+1
| | | | | | | ready for it yet. Notes: svn path=/head/; revision=22975
* This is the kernel Lite/2 commit. There are some requisite userlandJohn Dyson1997-02-101-10/+16
| | | | | | | | | | | | | | | | | | changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org> Notes: svn path=/head/; revision=22521
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise. Notes: svn path=/head/; revision=21673
* Improve the queuing algorithms used by NFS' asynchronous i/o. TheDoug Rabson1996-11-061-4/+4
| | | | | | | | | | | | | | | | | | | | | 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. This removes the sysctl variable vfs.nfs.dwrite since the new queueing mechanism removes the old delayed write code completely. This should go into the 2.2 branch. Notes: svn path=/head/; revision=19449
* In sys/time.h, struct timespec is defined as:Nate Williams1996-09-191-4/+4
| | | | | | | | | | | | | | | | | /* * Structure defined by POSIX.4 to be like a timeval. */ struct timespec { time_t ts_sec; /* seconds */ long ts_nsec; /* and nanoseconds */ }; The correct names of the fields are tv_sec and tv_nsec. Reminded by: James Drobina <jdrobina@infinet.com> Notes: svn path=/head/; revision=18397
* Even though this looks like it, this is not a complex code change.John Dyson1996-08-211-49/+6
| | | | | | | | | | | | | | | | | | | | The interface into the "VMIO" system has changed to be more consistant and robust. Essentially, it is now no longer necessary to call vn_open to get merged VM/Buffer cache operation, and exceptional conditions such as merged operation of VBLK devices is simpler and more correct. This code corrects a potentially large set of problems including the problems with ktrace output and loaded systems, file create/deletes, etc. Most of the changes to NFS are cosmetic and name changes, eliminating a layer of subroutine calls. The direct calls to vput/vrele have been re-instituted for better cross platform compatibility. Reviewed by: davidg Notes: svn path=/head/; revision=17761
* Various fixes from frank@fwi.uva.nl (Frank van der Linden) viaDoug Rabson1996-07-161-11/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rick@snowhite.cis.uoguelph.ca: 1. Clear B_NEEDCOMMIT in nfs_write to make sure that dirty data is correctly send to the server. If a buffer was dirtied when it was in the B_DELWRI+B_NEEDCOMMIT state, the state of the buffer was left unchanged and when the buffer was later cleaned, just a commit rpc was made to the server to complete the previous write. Clearing B_NEEDCOMMIT ensures that another write is made to the server. 2. If a server returned a server (for whatever reason) returned an answer to a write RPC that implied that fewer bytes than requested were written, bad things would happen. 3. The setattr operation passed on the atime in stead of the mtime to the server. The fix is trivial. 4. XIDs always started at 0, but this caused some servers (older DEC OSF/1 3.0 so I've been told) who had very long-lasting XID caches to get confused if, after a reboot of a BSD client, RPCs came in with a XID that had in the past been used before from that client. Patch is to use the current time in seconds as a starting point for XIDs. The patch below is not perfect, because it requires the root fs to be mounted first. This is because of the check BSD systems do, comparing FS time to system time. Reviewed by: Bruce Evans, Terry Lambert. Obtained from: frank@fwi.uva.nl (Frank van der Linden) via rick@snowhite.cis.uoguelph.ca Notes: svn path=/head/; revision=17186
* Don't truncate minor or major numbers in the nfsv3 client.Bruce Evans1996-06-231-3/+3
| | | | Notes: svn path=/head/; revision=16634
* Fix for NFS_NOSERVERPoul-Henning Kamp1996-06-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Poul mentioned that he thought this was some kind of timing problem, and that started me thinking. After a little poking around, I found that nfs_timer() was completely disabled when NFS_NOSERVER was #defined. But after looking at nfs_timer(), it seemed like it was something required by both the client and server code, and disabling it outright just didn't seem to make any sense. Parts of it relate only to the NFS server side code, so I disabled those, but I re-enabled the rest of the function and made sure that it would be called from nfs_init() (in nfs_subs.c). With nfs_timer() re-enabled, everything seems to work again. The only other changes I made were to #ifdef away some variable declarations in the NFS_NOSERVER case so that gcc would stop complaining about unused variables. Reviewed by: phk Submitted by: Bill Paul <wpaul@skynet.ctr.columbia.edu> Notes: svn path=/head/; revision=16365
* Eliminated many redundant vm_map_lookup operations for vm_mmap.John Dyson1996-01-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Speed up for vfs_bio -- addition of a routine bqrelse to greatly diminish overhead for merged cache. Efficiency improvement for vfs_cluster. It used to do alot of redundant calls to cluster_rbuild. Correct the ordering for vrele of .text and release of credentials. Use the selective tlb update for 486/586/P6. Numerous fixes to the size of objects allocated for files. Additionally, fixes in the various pagers. Fixes for proper positioning of vnode_pager_setsize in msdosfs and ext2fs. Fixes in the swap pager for exhausted resources. The pageout code will not as readily thrash. Change the page queue flags (PG_ACTIVE, PG_INACTIVE, PG_FREE, PG_CACHE) into page queue indices (PQ_ACTIVE, PQ_INACTIVE, PQ_FREE, PQ_CACHE), thereby improving efficiency of several routines. Eliminate even more unnecessary vm_page_protect operations. Significantly speed up process forks. Make vm_object_page_clean more efficient, thereby eliminating the pause that happens every 30seconds. Make sequential clustered writes B_ASYNC instead of B_DELWRI even in the case of filesystems mounted async. Fix a panic with busy pages when write clustering is done for non-VMIO buffers. Notes: svn path=/head/; revision=13490
* Add an option NFS_NOSERVER which saves 100K in the install kernel (orPoul-Henning Kamp1996-01-131-1/+18
| | | | | | | any other kernel that uses it). Use with option NFS. Notes: svn path=/head/; revision=13416
* Staticize.Poul-Henning Kamp1995-12-171-3/+8
| | | | Notes: svn path=/head/; revision=12911
* Untangled the vm.h include file spaghetti.David Greenman1995-12-071-1/+4
| | | | Notes: svn path=/head/; revision=12662
* Second batch of cleanup changes.Poul-Henning Kamp1995-10-291-3/+1
| | | | | | | | This time mostly making a lot of things static and some unused variables here and there. Notes: svn path=/head/; revision=11921
* Add support for amd direct maps.Doug Rabson1995-08-241-2/+2
| | | | | | | Reviewed by: Thomas Graichen <graichen@sirius.physik.fu-berlin.de> Notes: svn path=/head/; revision=10219
* Eliminate sloppy common-style declarations. There should be none left forBruce Evans1995-07-291-1/+11
| | | | | | | the LINT configuation. Notes: svn path=/head/; revision=9759
* vnode_pager_alloc() never returns NULL, so don't check for it.David Greenman1995-07-201-3/+2
| | | | Notes: svn path=/head/; revision=9588
* NOTE: libkvm, w, ps, 'top', and any other utility which depends on structDavid Greenman1995-07-131-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | proc or any VM system structure will have to be rebuilt!!! Much needed overhaul of the VM system. Included in this first round of changes: 1) Improved pager interfaces: init, alloc, dealloc, getpages, putpages, haspage, and sync operations are supported. The haspage interface now provides information about clusterability. All pager routines now take struct vm_object's instead of "pagers". 2) Improved data structures. In the previous paradigm, there is constant confusion caused by pagers being both a data structure ("allocate a pager") and a collection of routines. The idea of a pager structure has escentially been eliminated. Objects now have types, and this type is used to index the appropriate pager. In most cases, items in the pager structure were duplicated in the object data structure and thus were unnecessary. In the few cases that remained, a un_pager structure union was created in the object to contain these items. 3) Because of the cleanup of #1 & #2, a lot of unnecessary layering can now be removed. For instance, vm_object_enter(), vm_object_lookup(), vm_object_remove(), and the associated object hash list were some of the things that were removed. 4) simple_lock's removed. Discussion with several people reveals that the SMP locking primitives used in the VM system aren't likely the mechanism that we'll be adopting. Even if it were, the locking that was in the code was very inadequate and would have to be mostly re-done anyway. The locking in a uni-processor kernel was a no-op but went a long way toward making the code difficult to read and debug. 5) Places that attempted to kludge-up the fact that we don't have kernel thread support have been fixed to reflect the reality that we are really dealing with processes, not threads. The VM system didn't have complete thread support, so the comments and mis-named routines were just wrong. We now use tsleep and wakeup directly in the lock routines, for instance. 6) Where appropriate, the pagers have been improved, especially in the pager_alloc routines. Most of the pager_allocs have been rewritten and are now faster and easier to maintain. 7) The pagedaemon pageout clustering algorithm has been rewritten and now tries harder to output an even number of pages before and after the requested page. This is sort of the reverse of the ideal pagein algorithm and should provide better overall performance. 8) Unnecessary (incorrect) casts to caddr_t in calls to tsleep & wakeup have been removed. Some other unnecessary casts have also been removed. 9) Some almost useless debugging code removed. 10) Terminology of shadow objects vs. backing objects straightened out. The fact that the vm_object data structure escentially had this backwards really confused things. The use of "shadow" and "backing object" throughout the code is now internally consistent and correct in the Mach terminology. 11) Several minor bug fixes, including one in the vm daemon that caused 0 RSS objects to not get purged as intended. 12) A "default pager" has now been created which cleans up the transition of objects to the "swap" type. The previous checks throughout the code for swp->pg_data != NULL were really ugly. This change also provides the rudiments for future backing of "anonymous" memory by something other than the swap pager (via the vnode pager, for example), and it allows the decision about which of these pagers to use to be made dynamically (although will need some additional decision code to do this, of course). 13) (dyson) MAP_COPY has been deprecated and the corresponding "copy object" code has been removed. MAP_COPY was undocumented and non- standard. It was furthermore broken in several ways which caused its behavior to degrade to MAP_PRIVATE. Binaries that use MAP_COPY will continue to work correctly, but via the slightly different semantics of MAP_PRIVATE. 14) (dyson) Sharing maps have been removed. It's marginal usefulness in a threads design can be worked around in other ways. Both #12 and #13 were done to simplify the code and improve readability and maintain- ability. (As were most all of these changes) TODO: 1) Rewrite most of the vnode pager to use VOP_GETPAGES/PUTPAGES. Doing this will reduce the vnode pager to a mere fraction of its current size. 2) Rewrite vm_fault and the swap/vnode pagers to use the clustering information provided by the new haspage pager interface. This will substantially reduce the overhead by eliminating a large number of VOP_BMAP() calls. The VOP_BMAP() filesystem interface should be improved to provide both a "behind" and "ahead" indication of contiguousness. 3) Implement the extended features of pager_haspage in swap_pager_haspage(). It currently just says 0 pages ahead/behind. 4) Re-implement the swap device (swstrategy) in a more elegant way, perhaps via a much more general mechanism that could also be used for disk striping of regular filesystems. 5) Do something to improve the architecture of vm_object_collapse(). The fact that it makes calls into the swap pager and knows too much about how the swap pager operates really bothers me. It also doesn't allow for collapsing of non-swap pager objects ("unnamed" objects backed by other pagers). Notes: svn path=/head/; revision=9507
* Moved call to VOP_GETATTR() out of vnode_pager_alloc() and into the placesDavid Greenman1995-07-091-3/+10
| | | | | | | | | that call vnode_pager_alloc() so that a failure return can be dealt with. This fixes a panic seen on NFS clients when a file being opened is deleted on the server before the open completes. Notes: svn path=/head/; revision=9456
* 1) Converted v_vmdata to v_object.David Greenman1995-06-281-25/+21
| | | | | | | | | | 2) Removed unnecessary vm_object_lookup()/pager_cache(object, TRUE) pairs after vnode_pager_alloc() calls - the object is already guaranteed to be persistent. 3) Removed some gratuitous casts. Notes: svn path=/head/; revision=9356
* Changes to support version 3 of the NFS protocol.Doug Rabson1995-06-271-167/+868
| | | | | | | | | | | | | | | | | | | | | The version 2 support has been tested (client+server) against FreeBSD-2.0, IRIX 5.3 and FreeBSD-current (using a loopback mount). The version 2 support is stable AFAIK. The version 3 support has been tested with a loopback mount and minimally against an IRIX 5.3 server. It needs more testing and may have problems. I have patched amd to support the new variable length filehandles although it will still only use version 2 of the protocol. Before booting a kernel with these changes, nfs clients will need to at least build and install /usr/sbin/mount_nfs. Servers will need to build and install /usr/sbin/mountd. NFS diskless support is untested. Obtained from: Rick Macklem <rick@snowhite.cis.uoguelph.ca> Notes: svn path=/head/; revision=9336