aboutsummaryrefslogtreecommitdiff
path: root/sys/nfsserver
Commit message (Collapse)AuthorAgeFilesLines
...
* Convert more malloc+bzero to malloc+M_ZERO.David Malone2000-12-082-10/+6
| | | | | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net> Notes: svn path=/head/; revision=69781
* Simplify the tprintf() API.Poul-Henning Kamp2000-11-261-8/+1
| | | | | | | Loose the special <sys/tprintf.h> #include file. Notes: svn path=/head/; revision=69214
* This patchset fixes a large number of file descriptor race conditions.Matthew Dillon2000-11-181-2/+5
| | | | | | | | | | | | | | | Pre-rfork code assumed inherent locking of a process's file descriptor array. However, with the advent of rfork() the file descriptor table could be shared between processes. This patch closes over a dozen serious race conditions related to one thread manipulating the table (e.g. closing or dup()ing a descriptor) while another is blocked in an open(), close(), fcntl(), read(), write(), etc... PR: kern/11629 Discussed with: Alexander Viro <viro@math.psu.edu> Notes: svn path=/head/; revision=68883
* In preparation for deprecating CIRCLEQ macros in favor of TAILQKirk McKusick2000-11-141-1/+1
| | | | | | | | macros which provide the same functionality and are a bit more efficient, convert use of CIRCLEQ's in NFS to TAILQ's. Notes: svn path=/head/; revision=68711
* Remove unneeded #include <sys/proc.h> lines.Poul-Henning Kamp2000-10-291-1/+0
| | | | Notes: svn path=/head/; revision=67882
* Problem to avoid processes getting stuck in "vmopar". From Ian'sDavid Malone2000-10-244-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mail: The problem seems to originate with NFS's postop_attr information that is returned with a read or write RPC. Within a vm_fault context, the code cannot deal with vnode_pager_setsize() shrinking a vnode. The workaround in the patch below stops the nfsm_postop_attr() macro from ever shrinking a vnode. If the new size in the postop_attr information is smaller, then it just sets the nfsnode n_attrstamp to 0 to stop the wrong size getting used in the future. This change only affects postop_attr attributes; the nfsm_loadattr() macro works as normal. The change is implemented by adding a new argument to nfs_loadattrcache() called 'dontshrink'. When this is non-zero, nfs_loadattrcache() will never reduce the vnode/nfsnode size; instead it zeros n_attrstamp. There remain other was processes can get stuck in vmopar. Submitted by: Ian Dowse <iedowse@maths.tcd.ie> Reviewed by: dillon Tested by: Vadim Belman <voland@lflat.org> Notes: svn path=/head/; revision=67486
* Major update to the way synchronization is done in the kernel. HighlightsJason Evans2000-09-071-0/+1
| | | | | | | | | | | | | | | | | | include: * Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.) * Per-CPU idle processes. * Interrupts are run in their own separate kernel threads and can be preempted (i386 only). Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh Notes: svn path=/head/; revision=65557
* This patch corrects the first round of panics and hangs reportedKirk McKusick2000-07-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with the new snapshot code. Update addaliasu to correctly implement the semantics of the old checkalias function. When a device vnode first comes into existence, check to see if an anonymous vnode for the same device was created at boot time by bdevvp(). If so, adopt the bdevvp vnode rather than creating a new vnode for the device. This corrects a problem which caused the kernel to panic when taking a snapshot of the root filesystem. Change the calling convention of vn_write_suspend_wait() to be the same as vn_start_write(). Split out softdep_flushworklist() from softdep_flushfiles() so that it can be used to clear the work queue when suspending filesystem operations. Access to buffers becomes recursive so that snapshots can recursively traverse their indirect blocks using ffs_copyonwrite() when checking for the need for copy on write when flushing one of their own indirect blocks. This eliminates a deadlock between the syncer daemon and a process taking a snapshot. Ensure that softdep_process_worklist() can never block because of a snapshot being taken. This eliminates a problem with buffer starvation. Cleanup change in ffs_sync() which did not synchronously wait when MNT_WAIT was specified. The result was an unclean filesystem panic when doing forcible unmount with heavy filesystem I/O in progress. Return a zero'ed block when reading a block that was not in use at the time that a snapshot was taken. Normally, these blocks should never be read. However, the readahead code will occationally read them which can cause unexpected behavior. Clean up the debugging code that ensures that no blocks be written on a filesystem while it is suspended. Snapshots must explicitly label the blocks that they are writing during the suspension so that they do not cause a `write on suspended filesystem' panic. Reorganize ffs_copyonwrite() to eliminate a deadlock and also to prevent a race condition that would permit the same block to be copied twice. This change eliminates an unexpected soft updates inconsistency in fsck caused by the double allocation. Use bqrelse rather than brelse for buffers that will be needed soon again by the snapshot code. This improves snapshot performance. Notes: svn path=/head/; revision=63788
* Add snapshots to the fast filesystem. Most of the changes supportKirk McKusick2000-07-111-1/+113
| | | | | | | | | | | | | | | | | | | | | | | the gating of system calls that cause modifications to the underlying filesystem. The gating can be enabled by any filesystem that needs to consistently suspend operations by adding the vop_stdgetwritemount to their set of vnops. Once gating is enabled, the function vfs_write_suspend stops all new write operations to a filesystem, allows any filesystem modifying system calls already in progress to complete, then sync's the filesystem to disk and returns. The function vfs_write_resume allows the suspended write operations to begin again. Gating is not added by default for all filesystems as for SMP systems it adds two extra locks to such critical kernel paths as the write system call. Thus, gating should only be added as needed. Details on the use and current status of snapshots in FFS can be found in /sys/ufs/ffs/README.snapshot so for brevity and timelyness is not included here. Unless and until you create a snapshot file, these changes should have no effect on your system (famous last words). Notes: svn path=/head/; revision=62976
* Back out the previous change to the queue(3) interface.Jake Burkholder2000-05-265-39/+39
| | | | | | | | | It was not discussed and should probably not happen. Requested by: msmith and others Notes: svn path=/head/; revision=60938
* Change the way that the queue(3) structures are declared; don't assume thatJake Burkholder2000-05-235-39/+39
| | | | | | | | | | | the type argument to *_HEAD and *_ENTRY is a struct. Suggested by: phk Reviewed by: phk Approved by: mdodd Notes: svn path=/head/; revision=60833
* Separate the struct bio related stuff out of <sys/buf.h> intoPoul-Henning Kamp2000-05-053-0/+3
| | | | | | | | | | | | | | | | | | <sys/bio.h>. <sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall not be made a nested include according to bdes teachings on the subject of nested includes. Diskdrivers and similar stuff below specfs::strategy() should no longer need to include <sys/buf.> unless they need caching of data. Still a few bogus uses of struct buf to track down. Repocopy by: peter Notes: svn path=/head/; revision=60041
* Remove unneeded #include <vm/vm_zone.h>Poul-Henning Kamp2000-04-302-2/+0
| | | | | | | Generated by: src/tools/tools/kerninclude Notes: svn path=/head/; revision=59794
* Remove ~25 unneeded #include <sys/conf.h>Poul-Henning Kamp2000-04-191-1/+0
| | | | | | | Remove ~60 unneeded #include <sys/malloc.h> Notes: svn path=/head/; revision=59391
* Add a sysctl to specify the amount of UDP receive space NFS shouldMatthew Dillon2000-03-271-8/+22
| | | | | | | | | | | | | | reserve, in maximal NFS packets. Originally only 2 packets worth of space was reserved. The default is now 4, which appears to greatly improve performance for slow to mid-speed machines on gigabit networks. Add documentation and correct some prior documentation. Problem Researched by: Andrew Gallatin <gallatin@cs.duke.edu> Approved by: jkh Notes: svn path=/head/; revision=58710
* Rename the existing BUF_STRATEGY() to DEV_STRATEGY()Poul-Henning Kamp2000-03-201-1/+1
| | | | | | | | | | | substitute BUF_WRITE(foo) for VOP_BWRITE(foo->b_vp, foo) substitute BUF_STRATEGY(foo) for VOP_STRATEGY(foo->b_vp, foo) This patch is machine generated except for the ccd.c and buf.h parts. Notes: svn path=/head/; revision=58349
* Remove B_READ, B_WRITE and B_FREEBUF and replace them with a newPoul-Henning Kamp2000-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | field in struct buf: b_iocmd. The b_iocmd is enforced to have exactly one bit set. B_WRITE was bogusly defined as zero giving rise to obvious coding mistakes. Also eliminate the redundant struct buf flag B_CALL, it can just as efficiently be done by comparing b_iodone to NULL. Should you get a panic or drop into the debugger, complaining about "b_iocmd", don't continue. It is likely to write on your disk where it should have been reading. This change is a step in the direction towards a stackable BIO capability. A lot of this patch were machine generated (Thanks to style(9) compliance!) Vinum users: Greg has not had time to test this yet, be careful. Notes: svn path=/head/; revision=58345
* Clean up some loose ends in the network code, including the X.25 and ISOPeter Wemm2000-02-133-33/+0
| | | | | | | | | | #ifdefs. Clean out unused netisr's and leftover netisr linker set gunk. Tested on x86 and alpha, including world. Approved by: jkh Notes: svn path=/head/; revision=57178
* The alpha build cuases the 'nfsuid bloated' warning to occur. Well,Matthew Dillon2000-01-133-35/+0
| | | | | | | | | | | there is nothing we can do about it. In fact, after further review there simply are not very many instances of the two structures NFS checks for 'bloat' so I've decided to simply rip the checks out entirely. Submitted by: Andrew Gallatin <gallatin@cs.duke.edu> Notes: svn path=/head/; revision=55934
* tcp updates to support IPv6.Yoshinobu Inoue2000-01-091-1/+1
| | | | | | | | | | also a small patch to sys/nfs/nfs_socket.c, as max_hdr size change. Reviewed by: freebsd-arch, cvs-committers Obtained from: KAME project Notes: svn path=/head/; revision=55679
* Enhance reassignbuf(). When a buffer cannot be time-optimally insertedMatthew Dillon2000-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | into vnode dirtyblkhd we append it to the list instead of prepend it to the list in order to maintain a 'forward' locality of reference, which is arguably better then 'reverse'. The original algorithm did things this way to but at a huge time cost. Enhance the append interlock for NFS writes to handle intr/soft mounts better. Fix the hysteresis for NFS async daemon I/O requests to reduce the number of unnecessary context switches. Modify handling of NFS mount options. Any given user option that is too high now defaults to the kernel maximum for that option rather then the kernel default for that option. Reviewed by: Alfred Perlstein <bright@wintelcom.net> Notes: svn path=/head/; revision=55431
* Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"Peter Wemm1999-12-292-8/+8
| | | | | | | | | is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come. Notes: svn path=/head/; revision=55206
* make getfh a standard syscall instead of dependant on havingAlfred Perlstein1999-12-211-14/+0
| | | | | | | | | | | NFSSERVER defined, useful for userland fileservers that want to use a filehandle type interface to the filesystem. Submitted by: Assar Westerlund assar@stacken.kth.se PR: kern/15452 Notes: svn path=/head/; revision=54970
* M_PREPEND-related cleanups (unregisterifying struct mbuf *s).Brian Feldman1999-12-192-4/+3
| | | | Notes: svn path=/head/; revision=54799
* Fix compilation warning on alpha when converting pointer to integerMatthew Dillon1999-12-181-1/+1
| | | | | | | | | to generate hash index. Reviewed by: Andrew Gallatin <gallatin@cs.duke.edu> Notes: svn path=/head/; revision=54785
* Have NFS use a snapshot of boottime instead of boottime itself toMatthew Dillon1999-12-161-6/+14
| | | | | | | | | | | | | | generate the NFSv3 Version id. boottime itself may change, sometimes once every tick if you are running xntpd, which really throws off clients. Clients will tend to throw away what they believe to be stale data too often, and can get into long loops rewriting the same data over and over again because they believe the server has rebooted over and over again due to the changing version id. Approved by: jkh Notes: svn path=/head/; revision=54693
* Introduce NDFREE (and remove VOP_ABORTOP)Eivind Eklund1999-12-152-121/+27
| | | | Notes: svn path=/head/; revision=54655
* Add a readahead heuristic to the NFS server side code. While the serverMatthew Dillon1999-12-131-1/+77
| | | | | | | | | | | | | | cannot unilaterally pass data to a client it can reduce the physical disk transaction overhead by reading larger blocks. This results in better pipelining of requests/responses over the network and an almost 100% increase in cpu efficiency on the server. On a 100BaseTX network NFS read performance increases from 8.5 MBytes/sec to 10 MB/sec (maxed out), and cpu efficiency increases from 72% idle to 80% idle on the server. Reviewed by: Alfred Perlstein <bright@wintelcom.net> Notes: svn path=/head/; revision=54567
* PR: kern/15222Matthew Dillon1999-12-131-0/+16
| | | | | | | Submitted by: Ian Dowse <iedowse@maths.tcd.ie> Notes: svn path=/head/; revision=54564
* Fix a timeout deadlock that can occur when the process holding theMatthew Dillon1999-12-131-4/+24
| | | | | | | | | | receive lock hasn't yet managed to send its own request. PR: kern/15055 Submitted by: Ian Dowse iedowse@maths.tcd.ie Notes: svn path=/head/; revision=54536
* Fix a number of server-side issues related to aborting badly formedMatthew Dillon1999-12-122-4/+7
| | | | | | | | | | | NFS packets, mainly initializing structure pointers to NULL which are conditionally freed prior to return. PR: kern/15249 Submitted by: Ian Dowse <iedowse@maths.tcd.ie> Notes: svn path=/head/; revision=54485
* Synopsis of problem being fixed: Dan Nelson originally reported thatMatthew Dillon1999-12-121-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | blocks of zeros could wind up in a file written to over NFS by a client. The problem only occurs a few times per several gigabytes of data. This problem turned out to be bug #3 below. bug #1: B_CLUSTEROK must be cleared when an NFS buffer is reverted from stage 2 (ready for commit rpc) to stage 1 (ready for write). Reversions can occur when a dirty NFS buffer is redirtied with new data. Otherwise the VFS/BIO system may end up thinking that a stage 1 NFS buffer is clusterable. Stage 1 NFS buffers are not clusterable. bug #2: B_CLUSTEROK was inappropriately set for a 'short' NFS buffer (short buffers only occur near the EOF of the file). Change to only set when the buffer is a full biosize (usually 8K). This bug has no effect but should be fixed in -current anyway. It need not be backported. bug #3: B_NEEDCOMMIT was inappropriately set in nfs_flush() (which is typically only called by the update daemon). nfs_flush() does a multi-pass loop but due to the lack of vnode locking it is possible for new buffers to be added to the dirtyblkhd list while a flush operation is going on. This may result in nfs_flush() setting B_NEEDCOMMIT on a buffer which has *NOT* yet gone through its stage 1 write, causing only the commit rpc to be made and thus causing the contents of the buffer to be thrown away (never sent to the server). The patch also contains some cleanup, which only applies to the commit into -current. Reviewed by: dg, julian Originally Reported by: Dan Nelson <dnelson@emsphone.com> Notes: svn path=/head/; revision=54480
* nm_srtt and nm_sdrtt are arrays[4]. Remove explicit initializationMatthew Dillon1999-11-221-3/+3
| | | | | | | | | | | | of element [4] in both, which goes beyond the end of the array, leaving [0], [1], [2], and [3]. This bug did not cause any problems since the overrun fields are initialized after the bogus array init but needs to be fixed anyway. Submitted by: Ian Dowse <iedowse@maths.tcd.ie> Notes: svn path=/head/; revision=53552
* Remove WILLRELE from VOP_SYMLINKEivind Eklund1999-11-131-15/+6
| | | | | | | | | Note: Previous commit to these files (except coda_vnops and devfs_vnops) that claimed to remove WILLRELE from VOP_RENAME actually removed it from VOP_MKNOD. Notes: svn path=/head/; revision=53131
* Remove WILLRELE from VOP_RENAMEEivind Eklund1999-11-121-13/+14
| | | | Notes: svn path=/head/; revision=53101
* Remove special case socket sharing code in order to allow nfsd toMatthew Dillon1999-11-111-12/+12
| | | | | | | | | | bind IP addresses to udp/cltp sockets separately. PR: kern/13049 Reviewed by: David Malone <dwmalone@maths.tcd.ie>, freebsd-current Notes: svn path=/head/; revision=53095
* Fix nfssvc_addsock() to not attempt to free a NULL socket structureMatthew Dillon1999-11-081-3/+6
| | | | | | | | | | | | when returning an error. Bug fix was extracted from the PR. The PR is not yet entirely resolved by this commit. PR: kern/13049 Reviewed by: Matt Dillon <dillon@freebsd.org> Submitted by: Ian Dowse <iedowse@maths.tcd.ie> Notes: svn path=/head/; revision=53022
* Move NFS access cache hits/misses into nfsstats structure soMatthew Dillon1999-10-252-0/+4
| | | | | | | /usr/bin/nfsstat can get to it easily. Notes: svn path=/head/; revision=52492
* Before we start to mess with the VFS name-cache clean things up a little bit:Poul-Henning Kamp1999-10-031-2/+0
| | | | | | | Isolate the namecache in its own file, and give it a dedicated malloc type. Notes: svn path=/head/; revision=51906
* Careless use of struct proc *p caused major problems. 'p' is allowed toMarcel Moolenaar1999-09-291-4/+8
| | | | | | | | | | be NULL in this function (nfs_sigintr). Reorder the statements and guard them all with a single if (p != NULL). reported, reviewed and tested by: jdp Notes: svn path=/head/; revision=51799
* Make FreeBSD less conservative in determining when to return a cookieMatthew Dillon1999-09-291-0/+4
| | | | | | | | | | | | | | | | | | | | | | | error for a directory. I have made this change after a great deal of review although I cannot be absolutely sure that this meets the spec. The issue devolves into whether changes in an underlying (UFS) directory can cause NFS directory blocks to be renumbered. My read of the code indicates that NFS directory blocks will not be renumbered, which means that the cookies should still remain valid after a change is made to the underlying directory. This being the case, a cookie error should not be returned when a change is made to the underlying directory and, instead, the NFS client should rely on mtime detection to invalidate and reload the directory. The use of mtime is problematic in of itself, due to insufficient resolution, which is why I believe the original conservative error handling was done. Still, there have been dozens of bug reports by people needing solaris<->FreeBSD interoperability and these have to be accomodated. Notes: svn path=/head/; revision=51796
* sigset_t change (part 2 of 5)Marcel Moolenaar1999-09-293-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ----------------------------- The core of the signalling code has been rewritten to operate on the new sigset_t. No methodological changes have been made. Most references to a sigset_t object are through macros (see signalvar.h) to create a level of abstraction and to provide a basis for further improvements. The NSIG constant has not been changed to reflect the maximum number of signals possible. The reason is that it breaks programs (especially shells) which assume that all signals have a non-null name in sys_signame. See src/bin/sh/trap.c for an example. Instead _SIG_MAXSIG has been introduced to hold the maximum signal possible with the new sigset_t. struct sigprop has been moved from signalvar.h to kern_sig.c because a) it is only used there, and b) access must be done though function sigprop(). The latter because the table doesn't holds properties for all signals, but only for the first NSIG signals. signal.h has been reorganized to make reading easier and to add the new and/or modified structures. The "old" structures are moved to signalvar.h to prevent namespace polution. Especially the coda filesystem suffers from the change, because it contained lines like (p->p_sigmask == SIGIO), which is easy to do for integral types, but not for compound types. NOTE: kdump (and port linux_kdump) must be recompiled. Thanks to Garrett Wollman and Daniel Eischen for pressing the importance of changing sigreturn as well. Notes: svn path=/head/; revision=51791
* Asynchronized client-side nfs_commit. NFS commit operations wereMatthew Dillon1999-09-173-3/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | previously issued synchronously even if async daemons (nfsiod's) were available. The commit has been moved from the strategy code to the doio code in order to asynchronize it. Removed use of lastr in preparation for removal of vnode->v_lastr. It has been replaced with seqcount, which is already supported by the system and, in fact, gives us a better heuristic for sequential detection then lastr ever did. Made major performance improvements to the server side commit. The server previously fsync'd the entire file for each commit rpc. The server now bawrite()s only those buffers related to the offset/size specified in the commit rpc. Note that we do not commit the meta-data yet. This works still needs to be done. Note that a further optimization can be done (and has not yet been done) on the client: we can merge multiple potential commit rpc's into a single rpc with a greater file offset/size range and greatly reduce rpc traffic. Reviewed by: Alan Cox <alc@cs.rice.edu>, David Greenman <dg@root.com> Notes: svn path=/head/; revision=51344
* Seperate the export check in VFS_FHTOVP, exports are now checked viaAlfred Perlstein1999-09-112-42/+4
| | | | | | | | | | | | VFS_CHECKEXP. Add fh(open|stat|stafs) syscalls to allow userland to query filesystems based on (network) filehandle. Obtained from: NetBSD Notes: svn path=/head/; revision=51138
* remove unused variables.Poul-Henning Kamp1999-08-281-1/+0
| | | | Notes: svn path=/head/; revision=50521
* $Id$ -> $FreeBSD$Peter Wemm1999-08-2810-10/+10
| | | | Notes: svn path=/head/; revision=50477
* Simplify the handling of VCHR and VBLK vnodes using the new dev_t:Poul-Henning Kamp1999-08-261-21/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the alias list a SLIST. Drop the "fast recycling" optimization of vnodes (including the returning of a prexisting but stale vnode from checkalias). It doesn't buy us anything now that we don't hardlimit vnodes anymore. Rename checkalias2() and checkalias() to addalias() and addaliasu() - which takes dev_t and udev_t arg respectively. Make the revoke syscalls use vcount() instead of VALIASED. Remove VALIASED flag, we don't need it now and it is faster to traverse the much shorter lists than to maintain the flag. vfs_mountedon() can check the dev_t directly, all the vnodes point to the same one. Print the devicename in specfs/vprint(). Remove a couple of stale LFS vnode flags. Remove unimplemented/unused LK_DRAINED; Notes: svn path=/head/; revision=50405
* Convert all the nfs macros to do { blah } while (0) to ensure itPeter Wemm1999-08-191-111/+168
| | | | | | | | | works correctly in if/else etc. egcs had probably picked up most of the problems here before with "ambiguous braces" etc, but this should increase the robustness a bit. Based on an idea from Eivind Eklund. Notes: svn path=/head/; revision=50053
* Decommision miscfs/specfs/specdev.h. Most of it goes into <sys/conf.h>,Poul-Henning Kamp1999-08-081-3/+2
| | | | | | | | | a few lines into <sys/vnode.h>. Add a few fields to struct specinfo, paving the way for the fun part. Notes: svn path=/head/; revision=49535
* Don't over-allocate and over-copy shorter NFSv2 filehandles and thenPeter Wemm1999-08-041-10/+11
| | | | | | | | | | | | | correct the pointers afterwards. It's kinda bogus that we generate a 24 (?) byte filehandle (2 x int32 fsid and 16 byte VFS fhandle) and pad it out to 64 bytes for NFSv3 with garbage. The whole point of NFSv3's variable filehandle length was to allow for shorter handles, both in memory and over the wire. I plan on taking a shot at fixing this shortly. Notes: svn path=/head/; revision=49405