summaryrefslogtreecommitdiff
path: root/sys/nfsclient/nfs_socket.c
Commit message (Collapse)AuthorAgeFilesLines
* - The NFS client was incorrectly masking SIGSTOP (which isPaul Saab2005-03-231-19/+6
| | | | | | | | | | | | | | non-maskable). - The NFS client needs to guard against spurious wakeups while waiting for the response. ltrace causes the process under question to wakeup (possibly from ptrace()), which causes NFS to wakeup from tsleep without the response being delivered. Submitted by: Mohan Srinivasan Notes: svn path=/head/; revision=144040
* Minor cleanup in nfs_request() and removal of a comment that doesn'tPaul Saab2005-02-261-10/+1
| | | | | | | | | reflect reality. Submitted by: Mohan Srinivasan Notes: svn path=/head/; revision=142568
* Fix for a potential NFS client race where shared data is updated fromPaul Saab2005-02-181-0/+4
| | | | | | | | | base context as well as the socket callback. Submitted by: Mohan Srinivasan Notes: svn path=/head/; revision=142070
* /* -> /*- for license, minor formatting changesWarner Losh2005-01-071-1/+1
| | | | Notes: svn path=/head/; revision=139823
* If the NFS/TCP stream is out of sync between the client and server,Paul Saab2005-01-051-1/+1
| | | | | | | | | | | and if the client (erroneously) reads the RPC length as 0 bytes, the client can loop around in the socket callback. Explicitly check for the length being 0 case and teardown/re-connect. Submitted by: Mohan Srinivasan Notes: svn path=/head/; revision=139744
* Always issue wakeups() to the NFS requestors under the mutexPaul Saab2004-12-071-7/+17
| | | | | | | | | to close all potential cases of missed wakeups. Submitted by: Mohan Srinivasan mohans at yahoo-inc dot com Notes: svn path=/head/; revision=138505
* Rewrite of the NFS client's reply handling. We now have NFS socketPaul Saab2004-12-061-401/+530
| | | | | | | | | | | upcalls which do RPC header parsing and match up the reply with the request. NFS calls now sleep on the nfsreq structure. This enables us to eliminate the NFS recvlock. Submitted by: Mohan Srinivasan mohans at yahoo-inc dot com Notes: svn path=/head/; revision=138496
* In nfs_timer(), pass curthread rather than &thread0 into the protocolRobert Watson2004-08-251-4/+2
| | | | | | | | | | | | | | send routine. In IPv6 UDP, the thread will be passed to suser(), which asserts that if a thread is used for a super user check, it be curthread. Many of these protocol entry points probably need to accept credentials instead of threads. MT5 candidate. Noticed/tested by: kuriyama Notes: svn path=/head/; revision=134281
* Turn off SO_REUSEADDR and SO_REUSEPORT, they were causing EADDRINUSEAlfred Perlstein2004-07-131-5/+1
| | | | | | | | | to be returned from the protocol stack. Pointy hat to me for not groking what those options _really_ mean. Notes: svn path=/head/; revision=132084
* Rename Alfred's kern_setsockopt to so_setsockopt, as this seems aDavid Malone2004-07-121-2/+2
| | | | | | | | | | | a better name. I have a kern_[sg]etsockopt which I plan to commit shortly, but the arguments to these function will be quite different from so_setsockopt. Approved by: alfred Notes: svn path=/head/; revision=132060
* Use SO_REUSEADDR and SO_REUSEPORT when reconnecting NFS mounts.Alfred Perlstein2004-07-121-2/+10
| | | | | | | | | | Tune the timeout from 5 seconds to 12 seconds. Provide a sysctl to show how many reconnects the NFS client has done. Seems to fix IPv6 from: kuriyama Notes: svn path=/head/; revision=132018
* Acquire socket lock in nfs_connect() connection/sleep loop to protectRobert Watson2004-07-061-6/+6
| | | | | | | socket state and avoid missed wakeups. Notes: svn path=/head/; revision=131717
* NFS mobility PHASE I, II & III (phase VI, and V pending):Alfred Perlstein2004-07-061-61/+170
| | | | | | | | | | | | | | | | | | Rebind the client socket when we experience a timeout. This fixes the case where our IP changes for some reason. Signal a VFS event when NFS transitions from up to down and vice versa. Add a placeholder vfs_sysctl where we will put status reporting shortly. Also: Make down NFS mounts return EIO instead of EINTR when there is a soft timeout or force unmount in progress. Notes: svn path=/head/; revision=131691
* When updating sb_flags, acquire the socket buffer lock to preventRobert Watson2004-06-241-0/+4
| | | | | | | races. Notes: svn path=/head/; revision=131021
* Convert GIANT_REQUIRED to NET_ASSERT_GIANT where Giant is used toRobert Watson2004-06-161-4/+4
| | | | | | | | protect socket operations. Leave one "as-is" as it also frobs rootvp. Notes: svn path=/head/; revision=130554
* Remove advertising clause from University of California Regent'sWarner Losh2004-04-071-4/+0
| | | | | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson Notes: svn path=/head/; revision=127977
* Spell 2 as SHUT_RDWR when used as an argument to soshutdown().Robert Watson2004-04-041-1/+1
| | | | Notes: svn path=/head/; revision=127857
* Reset callout if in nfs_timeout and rpcclnt_timeout functions. TimerAlexander Kabaev2004-03-281-0/+1
| | | | | | | | | | | | are supposed to continue firing as long as there is work to do, not stop after the first invocation. This is damage control after a patch that has been committed prematurely. Tested by: kris Notes: svn path=/head/; revision=127515
* only do nfs rpc callouts if there is work to do.Jim Rees2004-03-251-2/+5
| | | | | | | | Submitted by: kan Approved by: alfred Notes: svn path=/head/; revision=127421
* Add a comment with an explanation why we don't report EPIPE errors onPawel Jakub Dawidek2004-03-171-0/+5
| | | | | | | | | nfs sockets. Requested by: ru Notes: svn path=/head/; revision=127144
* Don't report EPIPE errors on nfs sockets. These can be due to idle tcpPawel Jakub Dawidek2004-03-171-2/+5
| | | | | | | | | mounts which will be closed by netapp, solaris, etc. if left idle too long. Obtained from: NetBSD Notes: svn path=/head/; revision=127137
* University of Michigan's Citi NFSv4 kernel client code.Alfred Perlstein2003-11-141-0/+8
| | | | | | | Submitted by: Jim Rees <rees@umich.edu> Notes: svn path=/head/; revision=122698
* Assert GIANT_REQUIRED where sockets are manipulated. This isSam Leffler2003-11-071-0/+8
| | | | | | | | | | preparatory for MPSAFE network commits and ongoing socket locking work. Supported by: FreeBSD Foundation Notes: svn path=/head/; revision=122261
* - Consistently set sopt_dir.Jeff Roberson2003-10-041-0/+2
| | | | | | | Pointed out by: pete@isilon.com Notes: svn path=/head/; revision=120755
* - Merge struct procsig with struct sigacts.John Baldwin2003-05-131-1/+3
| | | | | | | | | | | | | | | | | | | | - Move struct sigacts out of the u-area and malloc() it using the M_SUBPROC malloc bucket. - Add a small sigacts_*() API for managing sigacts structures: sigacts_alloc(), sigacts_free(), sigacts_copy(), sigacts_share(), and sigacts_shared(). - Remove the p_sigignore, p_sigacts, and p_sigcatch macros. - Add a mutex to struct sigacts that protects all the members of the struct. - Add sigacts locking. - Remove Giant from nosys(), kill(), killpg(), and kern_sigaction() now that sigacts is locked. - Several in-kernel functions such as psignal(), tdsignal(), trapsignal(), and thread_stopped() are now MP safe. Reviewed by: arch@ Approved by: re (rwatson) Notes: svn path=/head/; revision=114983
* - Move p->p_sigmask to td->td_sigmask. Signal masks will be per thread withJeff Roberson2003-03-311-1/+1
| | | | | | | | | | a follow on commit to kern_sig.c - signotify() now operates on a thread since unmasked pending signals are stored in the thread. - PS_NEEDSIGCHK moves to TDF_NEEDSIGCHK. Notes: svn path=/head/; revision=112888
* req can not be NULL or we'd die.Alfred Perlstein2003-03-261-6/+3
| | | | | | | Sponsored by: RED Notes: svn path=/head/; revision=112657
* More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9).Dag-Erling Smørgrav2003-03-021-7/+7
| | | | Notes: svn path=/head/; revision=111748
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-7/+7
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Get rid of a silly message I added back in Sept 2001 (1.68).Peter Wemm2003-02-181-4/+1
| | | | Notes: svn path=/head/; revision=111105
* Lock proc while accessing p_siglist, p_sigmask and p_sigignoreTim J. Robbins2003-02-151-1/+5
| | | | | | | in nfs_sigintr(). Notes: svn path=/head/; revision=110922
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-7/+7
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* Back our kernel support for reliable signal queues.Juli Mallett2002-10-011-7/+2
| | | | | | | Requested by: rwatson, phk, and many others Notes: svn path=/head/; revision=104306
* Lock access to the signal queue, and related structures, with PROC_LOCK.Juli Mallett2002-09-301-1/+5
| | | | | | | Submitted by: jhb Notes: svn path=/head/; revision=104241
* Convert use of p_siglist and old SIG*() macros to use <sys/ksiginfo.h>Juli Mallett2002-09-301-2/+3
| | | | | | | | | prototyped functions to get a sigset_t, and further to check for any queued signals, rather than an empty signal set, to go with the move to signal queues rather than signal sets. Notes: svn path=/head/; revision=104235
* Use m_length() instead of home-rolled versions.Poul-Henning Kamp2002-09-181-7/+1
| | | | Notes: svn path=/head/; revision=103554
* Now that we have a cached mount credential in struct mount, use it isteadPoul-Henning Kamp2002-09-081-1/+1
| | | | | | | of a private cached copy. Notes: svn path=/head/; revision=103099
* If we get a receive error in nfs_receive() and then get an error trying toJohn Baldwin2002-07-161-5/+6
| | | | | | | | | | | | obtain the send lock, we would bogusly try to unlock the send lock before returning resulting in a panic. Instead, only unlock the send lock if nfs_sndlock() succeeds and nfs_reconnect() fails. MFC after: 3 days Sponsored by: The Weather Channel Notes: svn path=/head/; revision=100175
* Add IPv6 support.Alfred Perlstein2002-07-151-23/+33
| | | | | | | Submitted by: Jean-Luc Richier <Jean-Luc.Richier@imag.fr> Notes: svn path=/head/; revision=100134
* Convert old style (type foo *)0 casts to NULLsMatthew Dillon2002-07-111-21/+17
| | | | | | | | PR: kern/40360 Requested by: Hiten PAndya via direct email Notes: svn path=/head/; revision=99797
* In namei(), we use a NULL thread for uio_td when doing a VOP_READLINK().John Baldwin2002-06-281-9/+8
| | | | | | | | | | | | | | | nfs_readlink() calls nfs_bioread() which passes in uio_td as the thread argument to nfs_getcacheblk(). In nfs_getcacheblk() we dereference the thread pointer to get a process pointer to pass to nfs_sigintr(). This obviously results in a panic. :) Rather than change nfs_getcacheblk() to check if the thread pointer is NULL when calling nfs_sigintr() like other callers do, change nfs_sigintr() to take a thread as the last argument instead of a process so none of the callers have to care if the thread is NULL or not. Notes: svn path=/head/; revision=98988
* Back out my lats commit of locking down a socket, it conflicts with hsu's work.Seigo Tanimura2002-05-311-16/+5
| | | | | | | Requested by: hsu Notes: svn path=/head/; revision=97658
* Don't tsleep() with an sb_mtx held.Dima Dorfman2002-05-271-2/+2
| | | | Notes: svn path=/head/; revision=97333
* Lock down a socket, milestone 1.Seigo Tanimura2002-05-201-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Add a mutex (sb_mtx) to struct sockbuf. This protects the data in a socket buffer. The mutex in the receive buffer also protects the data in struct socket. o Determine the lock strategy for each members in struct socket. o Lock down the following members: - so_count - so_options - so_linger - so_state o Remove *_locked() socket APIs. Make the following socket APIs touching the members above now require a locked socket: - sodisconnect() - soisconnected() - soisconnecting() - soisdisconnected() - soisdisconnecting() - sofree() - soref() - sorele() - sorwakeup() - sotryfree() - sowakeup() - sowwakeup() Reviewed by: alfred Notes: svn path=/head/; revision=96972
* The recent NFS forced unmount improvements introduced a side-effectIan Dowse2002-04-171-4/+4
| | | | | | | | | | | | | | | | | | | | where some client operations might be unexpectedly cancelled during an unsuccessful non-forced unmount attempt. This causes problems for amd(8), because it periodically attempts a non-forced unmount to check if the filesystem is still in use. Fix this by adding a new mountpoint flag MNTK_UNMOUNTF that is set only during the operation of a forced unmount. Use this instead of MNTK_UNMOUNT to trigger the cancellation of hung NFS operations. Also correct a problem where dounmount() might inadvertently clear the MNTK_UNMOUNT flag. Reported by: simokawa MFC after: 1 week Notes: svn path=/head/; revision=94903
* 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