aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/rpc.lockd
Commit message (Collapse)AuthorAgeFilesLines
* Add and document options to allow rpc.lockd and rpc.statd to run in theRavi Pokala2019-11-222-4/+20
| | | | | | | | | | | | | | | | foreground. This allows a separate process to monitor when and how those programs exit. That process can then restart them if needed. Submitted by: Alex Burlyga Reviewed by: bcr, imp MFC after: 1 week Sponsored by: Panasas Differential Revision: https://reviews.freebsd.org/D22474 Notes: svn path=/head/; revision=355006
* userland: Fix several typos and minor errorsEitan Adler2017-12-271-1/+1
| | | | | | | | | | | - duplicate words - typos - references to old versions of FreeBSD Reviewed by: imp, benno Notes: svn path=/head/; revision=327230
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326276
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-184-4/+12
| | | | | | | | | | | | | | | | | | | | The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Reduce code duplication in rpc.lockd.Xin LI2017-06-211-195/+76
| | | | | | | | | | | | | | | Reuse create_service code instead of duplicating it in lookup_addresses for kernel NLM. As a (good) side effect this also fixed a few issues that were already fixed in the former but never applied to the latter. Reviewed by: kevlo MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D11259 Notes: svn path=/head/; revision=320183
* Utilize SYSROOT from r320119 in places where DESTDIR may be wanting WORLDTMP.Bryan Drewery2017-06-191-2/+2
| | | | | | | | | | | | | | Since buildenv exports SYSROOT all of these uses will now look in WORLDTMP by default. sys/boot/efi/loader/Makefile A LIBSTAND hack is no longer required for buildenv. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=320122
* Check return value of seteuid() and bail out if we fail.Xin LI2017-06-191-2/+8
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=320093
* Fix buffer lengths.Xin LI2017-06-121-4/+3
| | | | | | | | | | | | | | | After r319369, the RPC code validates caller supplied buffer length in taddr2uaddr. When no -h is specified, the sizeof(ai_addr) is used, which is always smaller than the required size and therefore uaddr would be NULL, causing the kernel to copyin() from userland NULL and fail with EFAULT. Reviewed by: kevlo (via Telegram) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D11151 Notes: svn path=/head/; revision=319852
* Use .ALLSRC instead of RPCSRCEnji Cooper2017-03-011-2/+2
| | | | | | | | | | | This is a trivial simplification in the Makefile, meant to serve as a good example for what to do with rules like this. MFC after: 1 week Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=314454
* Add missing break in lock_partialfilelock(..) with NFS_RESERREnji Cooper2016-06-131-0/+1
| | | | | | | | | | | | | | | | | This will help ensure that the right error is trickled up when the function is called if the lock status is NFS_RESERR Differential Revision: https://reviews.freebsd.org/D6622 Reviewed by: rmacklem Approved by: re (gjb) Tested with: fsx; svn info/svnversion (uses bdb locking); locktests from Bull http://nfsv4.bullopensource.org/tools/tests/locktest.php MFC after: 2 weeks Reported by: Coverity CID: 1008161, 1304956 Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=301871
* Actually use the loop interation limit so carefully computed on theDon Lewis2016-05-161-1/+1
| | | | | | | | | | | | | | previous line to prevent buffer overflow. This turns out to not be important because the upstream xdr code already capped the object size at the proper value. Using the correct limit here looks a lot less scary and should please Coverity. Reported by: Coverity CID: 1199309, 1199310 MFC after: 1 week Notes: svn path=/head/; revision=299986
* NULL releasedfl after calling deallocate_file_lock() which frees itDon Lewis2016-05-161-0/+1
| | | | | | | | | | | | to avoid a use-after-free error in the debuglog() call at the top of the loop. Reported by: Coverity CID: 1006080 MFC after: 1 week Notes: svn path=/head/; revision=299897
* DIRDEPS_BUILD: Regenerate without local dependencies.Bryan Drewery2016-02-241-2/+0
| | | | | | | | | | | These are no longer needed after the recent 'beforebuild: depend' changes and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports skipping 'make depend'. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=295989
* Fix type mismatches for malloc(3) and Co.Ulrich Spörlein2015-12-291-1/+1
| | | | | | | | | | | | This is rather pedantic, as for most architectures it holds that sizeof(type *) == sizeof(type **) Found by: clang static analyzer Reviewed by: ed Differential Revision: https://reviews.freebsd.org/D4722 Notes: svn path=/head/; revision=292864
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+25
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge sync of headSimon J. Gerraty2015-05-272-3/+2
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=283595
| * Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * Merge headSimon J. Gerraty2014-04-284-157/+52
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265044
| * | Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * | Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * | Sync from headSimon J. Gerraty2012-11-041-2/+0
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=242545
| * | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | | | rpc.locked does not need to link to libutilBaptiste Daroussin2015-04-091-1/+1
| | | | | | | | | | | | | | | | Notes: svn path=/head/; revision=281340
* | | | When mountd is creating sockets, it iterates over all addresses specifiedRyan Stone2015-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in the "hosts" array and eventually looks up the network address with getaddrinfo(). At one point it checks for a numeric address and if it sees one, it sets a hint parameter to force getaddrinfo to interpret the host as a numeric address. However that hint is not cleared for subsequent iterations of the loop and if any hosts seen after this point are host names, getaddrinfo will fail on the name. The result of this bug is that you cannot pass a host name to the -h flag. Unfortunately, the first iteration will either process ::1 or 127.0.0.1, so the flag is set on the first iteration and all host names will fail to be processed. The same bug applies to rpc.lockd and rpc.statd, so fix them too. Differential Revision: https://reviews.freebsd.org/D1507 Reported by: Dylan Martin MFC after: 1 week Sponsored by: Sandvine Inc. Notes: svn path=/head/; revision=277352
* | | | Convert usr.sbin to LIBADDBaptiste Daroussin2014-11-251-2/+1
| |_|/ |/| | | | | | | | | | | | | | | | | Reduce overlinking Notes: svn path=/head/; revision=275054
* | | multiple: Remove 3rd clause from BSD license where approved by theEitan Adler2014-03-141-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | regents and renumber. This patch skips files in contrib/ and crypto/ Acked by: imp Discussed with: emaste Notes: svn path=/head/; revision=263142
* | | Make a copy instead using constant string directly when assigning to char *.Xin LI2014-01-041-7/+3
| | | | | | | | | | | | | | | | | | | | | While I'm there also remove a few prototypes that are unused. Notes: svn path=/head/; revision=260251
* | | Use prototype.Xin LI2014-01-042-145/+48
| |/ |/| | | | | Notes: svn path=/head/; revision=260250
* | Remove dead return codeKevin Lo2012-09-111-2/+0
|/ | | | Notes: svn path=/head/; revision=240350
* Fix build:Xin LI2012-05-231-1/+1
| | | | | | | | | | - Use %ll instead of %q for explicit long long casts; - Use %j instead of %q in XFS and cast to intmax_t. Tested with: make universe Notes: svn path=/head/; revision=235822
* Consistently set RPCGEN_CPP when running rpcgen, so the C preprocessorDimitry Andric2012-02-071-1/+1
| | | | | | | | | set via ${CPP} is used, instead of always using hardcoded /usr/bin/cpp. MFC after: 1 week Notes: svn path=/head/; revision=231118
* Spelling fixes for usr.sbin/Ulrich Spörlein2011-12-302-5/+5
| | | | Notes: svn path=/head/; revision=228990
* Fix the nfs related daemons so that they don't intermittentlyRick Macklem2011-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 Notes: svn path=/head/; revision=222624
* rpc.lockd(8) WARNS cleanupUlrich Spörlein2010-12-203-6/+4
| | | | | | | | | | | | - 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 Notes: svn path=/head/; revision=216603
* Fix the include path for nfs_lock.h.Rick Macklem2010-07-241-1/+1
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=210456
* The last big commit: let usr.sbin/ use WARNS=6 by default.Ed Schouten2010-01-021-1/+1
| | | | Notes: svn path=/head/; revision=201390
* Don't use sys/nfs/rpcv2.h - it is part of the old kernel RPC implementationDoug Rabson2009-06-241-1/+0
| | | | | | | and will be removed. Notes: svn path=/head/; revision=194880
* Re-implement the client side of rpc.lockd in the kernel. This implementationDoug Rabson2008-06-261-43/+60
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=180025
* Add a missing call to init_nsm().Doug Rabson2008-06-021-0/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=179489
* If we can't find or load the kernel NLM support, don't just go ahead andDoug Rabson2008-04-101-1/+2
| | | | | | | try to use it anyway. Notes: svn path=/head/; revision=178066
* Call listen(2) on bound tcp sockets before passing them to svc_tli_create.Doug Rabson2008-04-061-0/+3
| | | | Notes: svn path=/head/; revision=177950
* Remove the '-k' option.Doug Rabson2008-03-271-1/+1
| | | | Notes: svn path=/head/; revision=177666
* Add kernel module support for nfslockd and krpc. Use the module systemDoug Rabson2008-03-272-11/+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. Notes: svn path=/head/; revision=177662
* Add the new kernel-mode NFS Lock Manager. To use it instead of theDoug Rabson2008-03-262-17/+257
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=177633
* Check the correct variables for malloc failures.Matteo Riondato2007-11-071-1/+1
| | | | | | | Submitted by: Michiel Boland <michiel@boland.org> Notes: svn path=/head/; revision=173411
* Add the -h <bindip> option to rpc.lockd, similar to the one inMatteo Riondato2007-11-022-109/+346
| | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=173281
* - Fix compilaton with DUMP_FILELOCK_VERBOSE.Jun Kuriyama2007-04-121-8/+8
| | | | | | | | - Use consistent "get_lock_matching_unlock" function name in debuglog(). Notes: svn path=/head/; revision=168640