summaryrefslogtreecommitdiff
path: root/sys/nfsclient/nfs_socket.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix a long line touched in previous commit (but not caused by previousPeter Wemm2002-02-071-1/+2
| | | | | | | commit) Notes: svn path=/head/; revision=90373
* Pre-KSE/M3 commit.Julian Elischer2002-02-071-2/+2
| | | | | | | | | | | | | this is a low-functionality change that changes the kernel to access the main thread of a process via the linked list of threads rather than assuming that it is embedded in the process. It IS still embeded there but remove all teh code that assumes that in preparation for the next commit which will actually move it out. Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice, Notes: svn path=/head/; revision=90361
* Terminate requests in nfs_sigintr() if the filesystem is in theIan Dowse2002-01-101-1/+4
| | | | | | | | | | | | | | | process of being unmounted. This allows forced NFS unmounts to complete even if there are processes stuck holding the mnt_lock while the server is down. The mechanism is not ideal in that there is a small chance we might accidentally cancel requests during a failed non-forced unmount attempt on that filesystem, but this is not really a big problem. Also, move the tsleep() in nfs_nmcancelreqs() so that we do not sleep in the case where there are no requests to be cancelled. Notes: svn path=/head/; revision=89174
* Permit NFS filesystems to be forcibly unmounted when the server isIan Dowse2002-01-021-7/+45
| | | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=88796
* o Make the credential used by socreate() an explicit argument toRobert Watson2001-12-311-1/+1
| | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=88739
* Add a #define for the size of the nfs_backoff[] array, and use thisIan Dowse2001-12-301-3/+4
| | | | | | | instead of magic constants in the code. Notes: svn path=/head/; revision=88712
* 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
* Make nfsm_dissect() have an obvious return value.Peter Wemm2001-09-271-4/+4
| | | | Notes: svn path=/head/; revision=84057
* Cleanup and split of nfs client and server code.Peter Wemm2001-09-181-1042/+115
| | | | | | | This builds on the top of several repo-copies. Notes: svn path=/head/; revision=83651
* KSE Milestone 2Julian Elischer2001-09-121-32/+35
| | | | | | | | | | | | | | | | | 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
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inMark Murray2001-05-011-6/+8
| | | | | | | | | | | | | | 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
* Revert consequences of changes to mount.h, part 2.Greg Lehey2001-04-291-2/+0
| | | | | | | Requested by: bde Notes: svn path=/head/; revision=76117
* Correct #includes to work with fixed sys/mount.h.Greg Lehey2001-04-231-0/+2
| | | | Notes: svn path=/head/; revision=75858
* * Rename M_WAIT mbuf subsystem flag to M_TRYWAIT.Bosko Milekic2000-12-211-8/+8
| | | | | | | | | | | | | | | | | | | | | This is because calls with M_WAIT (now M_TRYWAIT) may not wait forever when nothing is available for allocation, and may end up returning NULL. Hopefully we now communicate more of the right thing to developers and make it very clear that it's necessary to check whether calls with M_(TRY)WAIT also resulted in a failed allocation. M_TRYWAIT basically means "try harder, block if necessary, but don't necessarily wait forever." The time spent blocking is tunable with the kern.ipc.mbuf_wait sysctl. M_WAIT is now deprecated but still defined for the next little while. * Fix a typo in a comment in mbuf.h * Fix some code that was actually passing the mbuf subsystem's M_WAIT to malloc(). Made it pass M_WAITOK instead. If we were ever to redefine the value of the M_WAIT flag, this could have became a big problem. Notes: svn path=/head/; revision=70254
* 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
* 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
* 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
* M_PREPEND-related cleanups (unregisterifying struct mbuf *s).Brian Feldman1999-12-191-2/+2
| | | | Notes: svn path=/head/; revision=54799
* 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
* 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
* 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
* sigset_t change (part 2 of 5)Marcel Moolenaar1999-09-291-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ----------------------------- 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
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Various changes lifted from the OpenBSD cvs tree:Peter Wemm1999-06-051-13/+33
| | | | | | | | | | | | | | | | | | txdr_hyper and fxdr_hyper tweaks to avoid excessive CPU order knowledge. nfs_serv.c: don't call nfsm_adj() with negative values, windows clients could crash servers when doing a readdir of a large directory. nfs_socket.c: Use IP_PORTRANGE to get a priviliged port without a spin loop trying to bind(). Don't clobber a mbuf pointer or we get panics on a NFS3ERR_JUKEBOX error from a server when reusing a freed mbuf. nfs_subs.c: Don't loose st_blocks on NFSv2 mounts when > 2GB. Obtained from: OpenBSD Notes: svn path=/head/; revision=47751
* The VFS/BIO subsystem contained a number of hacks in order to optimizeAlan Cox1999-05-021-81/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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> Notes: svn path=/head/; revision=46349
* Fixed printf format errors on alpha.Dmitrij Tejblum1999-04-241-3/+3
| | | | Notes: svn path=/head/; revision=45996
* Untangle the nfs send and receive queue locking a little. One lockPeter Wemm1999-02-251-35/+26
| | | | | | | | | 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. Notes: svn path=/head/; revision=44246
* Silence -Wtrigraph.Tim Vanderhoek1998-12-301-4/+4
| | | | | | | Submitted by: Bradley Dunn <bradley@dunn.org> (pr: kern/8817) Notes: svn path=/head/; revision=42155
* The "easy" fixes for compiling the kernel -Wunused: remove unreferenced staticArchie Cobbs1998-12-071-2/+1
| | | | | | | and local variables, goto labels, and functions declared but not defined. Notes: svn path=/head/; revision=41591
* Fix a panic in nfsrv_dorec() where a NULL pointer could be passed toDoug Rabson1998-11-131-2/+4
| | | | | | | | | free() sometimes. Reviewed by: Eric Haug <ejh@eas.slu.edu> Notes: svn path=/head/; revision=41132
* The code checks each fragment mark to see if it's valid; if the fragmentKirk McKusick1998-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. Notes: svn path=/head/; revision=39788
* Made unloading of the nfs LKM sort of work. This is mainly to testBruce Evans1998-09-071-2/+3
| | | | | | | | | 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
* Yow! Completely change the way socket options are handled, eliminatingGarrett Wollman1998-08-231-10/+22
| | | | | | | | | another specialized mbuf type in the process. Also clean up some of the cruft surrounding IPFW, multicast routing, RSVP, and other ill-explored corners. Notes: svn path=/head/; revision=38482
* If we get an ENOBUFS from the network, it's normally transient networkPeter Wemm1998-08-011-1/+11
| | | | | | | | | | | | interface congestion (eg: nfs over a ppp link, etc). Don't log these for UDP mounts, and don't cause syscalls to fail with EINTR. This stops the 'nfs send error 55' warnings. If the error is because the system is really hosed, this is the least of your problems... Notes: svn path=/head/; revision=37997
* Cast pointers to uintptr_t/intptr_t instead of to u_long/long,Bruce Evans1998-07-151-3/+3
| | | | | | | | | | respectively. Most of the longs should probably have been u_longs, but this changes is just to prevent warnings about casts between pointers and integers of different sizes, not to fix poorly chosen types. Notes: svn path=/head/; revision=37649
* This commit fixes various 64bit portability problems required forDoug Rabson1998-06-071-3/+3
| | | | | | | | | | | | | FreeBSD/alpha. The most significant item is to change the command argument to ioctl functions from int to u_long. This change brings us inline with various other BSD versions. Driver writers may like to use (__FreeBSD_version == 300003) to detect this change. The prototype FreeBSD/alpha machdep will follow in a couple of days time. Notes: svn path=/head/; revision=36735
* For the on-the-wire protocol, u_long -> u_int32_t; long -> int32_t;Peter Wemm1998-05-311-58/+58
| | | | | | | | | | 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
* Support 'mount -u' remounts. This may require disconnecting and rebindingPeter Wemm1998-05-311-1/+14
| | | | | | | | | the socket. Certain mode changes are not allowed. Obtained from: NetBSD Notes: svn path=/head/; revision=36540
* Missed a cosmetic change that the other BSD's have.Peter Wemm1998-05-311-2/+2
| | | | Notes: svn path=/head/; revision=36517
* oops, nfs_msg() is called from client code too.Peter Wemm1998-05-311-1/+4
| | | | Notes: svn path=/head/; revision=36516
* When we can't reconnect a socket, don't forget to unlock before retryingPeter Wemm1998-05-311-1/+4
| | | | | | | | | or we can deadlock. Obtained from: NetBSD Notes: svn path=/head/; revision=36515
* Don't log zero length reads, this can happen during normal operation.Peter Wemm1998-05-311-1/+9
| | | | | | | Obtained from: NetBSD Notes: svn path=/head/; revision=36514
* Consider for readdir chunk sizes when tuning socket buffer reservations.Peter Wemm1998-05-311-3/+5
| | | | | | | Obtained from: NetBSD Notes: svn path=/head/; revision=36513
* NFS Jumbo commit part 1. Cosmetic and structural changes only. The aimPeter Wemm1998-05-311-269/+269
| | | | | | | | | 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
* Allow control of the attribute cache timeouts at mount time.Peter Wemm1998-05-191-30/+39
| | | | | | | | | 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
* Eradicate the variable "time" from the kernel, using various measures.Poul-Henning Kamp1998-03-301-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "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
* Removed unused #includes.Bruce Evans1997-10-281-2/+1
| | | | Notes: svn path=/head/; revision=30813
* Last major round (Unless Bruce thinks of somthing :-) of malloc changes.Poul-Henning Kamp1997-10-121-2/+2
| | | | | | | | | | | Distribute all but the most fundamental malloc types. This time I also remembered the trick to making things static: Put "static" in front of them. A couple of finer points by: bde Notes: svn path=/head/; revision=30354
* Added used #include - don't depend on <sys/mbuf.h> includingBruce Evans1997-09-021-1/+2
| | | | | | | <sys/malloc.h> (unless we only use the bogusly shared M*WAIT flags). Notes: svn path=/head/; revision=29024