summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rpc.lockd/lockd.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix the nfs related daemons so that they don't intermittentlyrmacklem2011-06-021-28/+221
| | | | | | | | | | | | | | | | | | | | | | | | fail with "bind: address already in use". This problem was reported to the freebsd-stable@ mailing list on Feb. 19 under the subject heading "statd/lockd startup failure" by george+freebsd at m5p dot com. The problem is that the first combination of {udp,tcp X ipv4,ipv6} would select a port# dynamically, but one of the other three combinations would have that port# already in use. The patch is somewhat involved because it was requested by dougb@ that the four combinations use the same port# wherever possible. The patch splits the create_service() function into two functions. The first goes as far as bind(2) in a loop for up to GETPORT_MAXTRY - 1 times, attempting to use the same port# for all four cases. If these attempts fail, the last attempt allows the 4 cases to use different port #s. After this function has succeeded, the second function, called complete_service(), does the rest of what create_service() did. The three daemons mountd, rpc.lockd and rpc.statd all have a create_service() function that is patched in a similar way. However, create_service() has non-trivial differences for the three daemons that made it impractical to share the same functions between them. Reviewed by: jhb MFC after: 2 weeks
* rpc.lockd(8) WARNS cleanupuqs2010-12-201-4/+1
| | | | | | | | | - Provide function prototype for nlm_syscall - Don't assign a variable from the stack to a global var[1] - Remove unused vars Found by: clang static analyser [1] Reviewed by: dfr
* Re-implement the client side of rpc.lockd in the kernel. This implementationdfr2008-06-261-45/+62
| | | | | | | | | | | | provides the correct semantics for flock(2) style locks which are used by the lockf(1) command line tool and the pidfile(3) library. It also implements recovery from server restarts and ensures that dirty cache blocks are written to the server before obtaining locks (allowing multiple clients to use file locking to safely share data). Sponsored by: Isilon Systems PR: 94256 MFC after: 2 weeks
* Add a missing call to init_nsm().dfr2008-06-021-0/+1
| | | | MFC after: 1 week
* If we can't find or load the kernel NLM support, don't just go ahead anddfr2008-04-101-1/+2
| | | | try to use it anyway.
* Call listen(2) on bound tcp sockets before passing them to svc_tli_create.dfr2008-04-061-0/+3
|
* Remove the '-k' option.dfr2008-03-271-1/+1
|
* Add kernel module support for nfslockd and krpc. Use the module systemdfr2008-03-271-5/+14
| | | | | | | to detect (or load) kernel NLM support in rpc.lockd. Remove the '-k' option to rpc.lockd and make kernel NLM the default. A user can still force the use of the old user NLM by building a kernel without NFSLOCKD and/or removing the nfslockd.ko module.
* Add the new kernel-mode NFS Lock Manager. To use it instead of thedfr2008-03-261-17/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | user-mode lock manager, build a kernel with the NFSLOCKD option and add '-k' to 'rpc_lockd_flags' in rc.conf. Highlights include: * Thread-safe kernel RPC client - many threads can use the same RPC client handle safely with replies being de-multiplexed at the socket upcall (typically driven directly by the NIC interrupt) and handed off to whichever thread matches the reply. For UDP sockets, many RPC clients can share the same socket. This allows the use of a single privileged UDP port number to talk to an arbitrary number of remote hosts. * Single-threaded kernel RPC server. Adding support for multi-threaded server would be relatively straightforward and would follow approximately the Solaris KPI. A single thread should be sufficient for the NLM since it should rarely block in normal operation. * Kernel mode NLM server supporting cancel requests and granted callbacks. I've tested the NLM server reasonably extensively - it passes both my own tests and the NFS Connectathon locking tests running on Solaris, Mac OS X and Ubuntu Linux. * Userland NLM client supported. While the NLM server doesn't have support for the local NFS client's locking needs, it does have to field async replies and granted callbacks from remote NLMs that the local client has contacted. We relay these replies to the userland rpc.lockd over a local domain RPC socket. * Robust deadlock detection for the local lock manager. In particular it will detect deadlocks caused by a lock request that covers more than one blocking request. As required by the NLM protocol, all deadlock detection happens synchronously - a user is guaranteed that if a lock request isn't rejected immediately, the lock will eventually be granted. The old system allowed for a 'deferred deadlock' condition where a blocked lock request could wake up and find that some other deadlock-causing lock owner had beaten them to the lock. * Since both local and remote locks are managed by the same kernel locking code, local and remote processes can safely use file locks for mutual exclusion. Local processes have no fairness advantage compared to remote processes when contending to lock a region that has just been unlocked - the local lock manager enforces a strict first-come first-served model for both local and remote lockers. Sponsored by: Isilon Systems PR: 95247 107555 115524 116679 MFC after: 2 weeks
* Check the correct variables for malloc failures.matteo2007-11-071-1/+1
| | | | Submitted by: Michiel Boland <michiel@boland.org>
* Add the -h <bindip> option to rpc.lockd, similar to the one inmatteo2007-11-021-110/+329
| | | | | | | | | | | | | | nfsd(8), in mountd(8), and in rpc.statd(8) -h bindip Specify specific IP addresses to bind to for TCP and UDP requests. This option may be specified multiple times. If no -h option is specified, rpc.lockd will bind to INADDR_ANY. Note that when specifying IP addresses with -h, rpc.lockd will automatically add 127.0.0.1 and if IPv6 is enabled, ::1 to the list. PR: bin/98500 MFC after: 1 week
* Add the "-p" option, which allows to specify a port which the daemonmatteo2007-04-031-7/+84
| | | | | | | | should bind to. PR: bin/100969 Reviewed by: alfred@ MFC after: 1 week
* Set alarm timer for grace period from the grace_period variable, insteadthomas2006-08-231-1/+1
| | | | | | | | of hard-coding a value of 10 seconds. Command line flag -g is thus now correctly taken into account. PR: bin/102176 MFC after: 1 week
* After talking to Colin,mr2004-07-161-1/+1
| | | | | | | | apply the patch of bin/61718 (which should include/elimatate kern/61122 also). It seems to fix a few annoying bugs. PR: bin/61718, kern/61122 Submitted by: bg@sics.se ohartman@mail.physik.uni-mainz.de
* Make this compile cleanly. It passes WARNS=2, but I haven't checkedpeter2003-10-261-1/+1
| | | | it is so on more platforms.
* init_nsm() is executed after a call to daemon(*, 0), so error andghelmer2003-04-241-2/+4
| | | | | | warning messages should be logged rather than sent to /dev/null. PR: bin/45461
* Implement nonblocking tpc-connections. rpcgen -m does stillmbr2003-01-161-1/+6
| | | | | | | | produce backcompatible code. Reviewed by: rwatson Obtained from: NetBSD MFC after: 1 day
* When binding to transports if getnetconfigent() fails then actuallyalfred2002-04-111-1/+2
| | | | | | print out the correct transport it failed on rather than always spitting out 'udp', also call nc_sperror() to give a more verbose error message detailing the problem.
* Use char foo[] = "BAR" to avoid direct assignment of const char * into char *.alfred2002-03-221-2/+4
| | | | | | rpcgen can't really make those fields const because the remote side might want to munge them, so we need to pass non-const in. Hackish, but should work.
* Remove main() prototype.alfred2002-03-211-1/+0
|
* Remove __P.alfred2002-03-211-8/+8
|
* Fold ANDREW_LOCKD into -current.alfred2001-11-291-9/+1
|
* Turn on NO_WERROR and set WARNS to 1.alfred2001-11-131-10/+6
| | | | | | | | | | | | Fix the WARNS 1 warnings except unused variables. Add prototype for log_netobj(). Don't compare signed/unsigned. Cast u_int64_t to 'unsigned long long' and print using %llu. Fix constness of string arrays. Use a cast to avoid an unused parameter in a signal handler. alarm(2) can't fail, so don't check for it. ANSI'ify some functions.
* Implement client side NFS locks.alfred2001-04-171-0/+55
| | | | | Obtained from: BSD/os Import Ok'd by: mckusick, jkh, motd on builder.freebsd.org
* Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) andalfred2001-03-191-56/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | associated changes that had to happen to make this possible as well as bugs fixed along the way. Bring in required TLI library routines to support this. Since we don't support TLI we've essentially copied what NetBSD has done, adding a thin layer to emulate direct the TLI calls into BSD socket calls. This is mostly from Sun's tirpc release that was made in 1994, however some fixes were backported from the 1999 release (supposedly only made available after this porting effort was underway). The submitter has agreed to continue on and bring us up to the 1999 release. Several key features are introduced with this update: Client calls are thread safe. (1999 code has server side thread safe) Updated, a more modern interface. Many userland updates were done to bring the code up to par with the recent RPC API. There is an update to the pthreads library, a function pthread_main_np() was added to emulate a function of Sun's threads library. While we're at it, bring in NetBSD's lockd, it's been far too long of a wait. New rpcbind(8) replaces portmap(8) (supporting communication over an authenticated Unix-domain socket, and by default only allowing set and unset requests over that channel). It's much more secure than the old portmapper. Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded to support TI-RPC and to support IPV6. Umount(8) is also fixed to unmount pathnames longer than 80 chars, which are currently truncated by the Kernel statfs structure. Submitted by: Martin Blapp <mb@imp.ch> Manpage review: ru Secure RPC implemented by: wpaul
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Use err(3). Add usage() and #includes.charnier1997-10-131-33/+27
|
* Fixed type mismatch caused by bogus prototypes. rpcgen for some reasonbde1997-04-151-2/+2
| | | | doesn't generate any prototypes for the functions to be registered.
* Tweaks for the stub lockd.peter1996-04-011-218/+6
| | | | | | | - Use rpcgen to generate the unmodified boilerplate code rather than having it in the repository. - Eliminate the conflicting function names by changing them to their "natural" rpcgen generated names
* Import Jan 15 version of Andrew Gordon <andrew.gordon@net-tel.co.uk>'speter1996-02-171-0/+325
stub lockd. This implements just the protocol, but does not interact with the kernel. It says "Yes!" to all requests. This is useful if you have people using tools that do locking for no reason (eg: some PC NFS systems running some Microsoft products) and will happily report they couldn't lock the file and merrily proceed anyway. Running this will not change the reliability of sharing files, it'll just keep it out of everybody's face.
OpenPOWER on IntegriCloud