Commit Graph

70 Commits

Author SHA1 Message Date
Michael Reifenberger
3d81d1ad2e After talking to Colin,
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
2004-07-16 12:50:10 +00:00
Stefan Farfeleder
a752604477 Remove spurious semicolons. Outside of functions they are actually errors but
GCC doesn't warn about them without -pedantic.

Approved by:	das (mentor)
PR:		56649
Reviewed by:	md5
2004-05-16 22:08:17 +00:00
Peter Pentchev
c0f7cd1a2a Make rpc.lockd bind to a reserved port, since there are NFS clients
which ignore NLM requests not coming from a reserved port.

PR:		56500
Submitted by:	Jonathan Lennox <lennox@cs.columbia.edu>
MFC after:	1 week
2004-03-04 15:52:28 +00:00
Alfred Perlstein
aba638209b The callrpc call to unmonitor hosts was passing the wrong xdr
decode/encode functions for the arguments to the statd unmonitor
call.  Fix it.
2004-02-17 00:13:59 +00:00
Peter Wemm
75e40e4604 Make this compile cleanly. It passes WARNS=2, but I haven't checked
it is so on more platforms.
2003-10-26 06:10:44 +00:00
Robert Watson
eda8b2821f When getting back an NLM DENIED response for a requested lock from the
server, map it to EAGAIN locally rather than EACCES.  The NLM spec
indicates the DENIED corresponds to lock contention, not a permission
failure.  This fixes O_EXLOCK/O_SHLOCK with O_NONBLOCK, which would
previously give a permission error, which in turn fixes things
like mailq(8) and lockf(1) over NFS.

Approved by:	scottl (re)
Reviewed by:	truckman, Andrew P Lentvorski, Jr. <bsder@allcaps.org>
Idea from:	truckman
2003-05-15 03:19:30 +00:00
Robert Watson
86eb7cbada Avoid registering for a lock on the server in the event the NFS client
has requested the lock in a non-blocking form, instead returning an
immediate failure.  This appears to help reduce one of my "locks get
lost" symptoms involving lockf(1), which attempts a non-blocking lock
attempt before actually blocking on the lock.  At this point the client
still gets back EACCES, which is an issue we're still working.

Approved by:	re (scottl)
Submitted by:	Andrew P. Lentvorski, Jr. <bsder@allcaps.org>
2003-05-14 21:16:33 +00:00
Robert Watson
1870b993d0 When receiving NLM_GRANTED_RES or NLM4_GRANTED_RES lock granted messages
from the NFS server, following contention on a lock by this or another
client, immediately notify the waiting process that the lock has been
granted via a wakeup.  Without this change, the client rpc.lockd will
not wakeup the waiting process until it next re-polls the lock (sometime
in the next ten seconds), which can lead to marked latency across all
potential lockers, as the lock is held by the client for the duration.

Approved by:	re (scottl)
Submitted by:	truckman
Reviewed by:	Andrew P. Lentvorski, Jr <bsder@allcaps.org>
2003-05-14 13:50:40 +00:00
Guy Helmer
8ebcf97e95 init_nsm() is executed after a call to daemon(*, 0), so error and
warning messages should be logged rather than sent to /dev/null.

PR:	bin/45461
2003-04-24 14:38:42 +00:00
David E. O'Brien
052238b16c style.Makefile(5) 2003-04-04 17:49:21 +00:00
Martin Blapp
bcb53b1606 Implement nonblocking tpc-connections. rpcgen -m does still
produce backcompatible code.

Reviewed by:	rwatson
Obtained from:	NetBSD
MFC after:	1 day
2003-01-16 07:27:30 +00:00
Alfred Perlstein
f898f7c5b2 Remove a case of exposing 'struct ucred' to userspace. Use a struct xucred
for LOCKD_MSG instead.

Requested by: rwatson
2002-08-15 21:52:22 +00:00
Alfred Perlstein
09ce4f7aaf Add IPv6 support.
Submitted by: Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
2002-07-15 19:40:23 +00:00
Philippe Charnier
490d5836b5 The .Nm utility 2002-07-14 14:47:15 +00:00
Alfred Perlstein
5ed43a1e8e When binding to transports if getnetconfigent() fails then actually
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.
2002-04-11 07:19:30 +00:00
Alfred Perlstein
e4b0fede2c Use char foo[] = "BAR" to avoid direct assignment of const char * into char *.
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.
2002-03-22 20:02:54 +00:00
Alfred Perlstein
7bb4bf8526 Const fix. 2002-03-22 20:00:10 +00:00
Alfred Perlstein
0d28a40a57 Remove cast that's not needed. 2002-03-22 19:57:09 +00:00
Alfred Perlstein
3af9aed6c5 WARNS from 3 to 4. still some warnings about assigning const char * to
char *, but we'll fix those later.
2002-03-22 19:50:58 +00:00
Alfred Perlstein
efddf1388d constify log_from_addr() parameter. 2002-03-22 19:20:35 +00:00
Alfred Perlstein
c4bc47ba6a Bring code to WARNS=3 level. Mostly fix unused variables. 2002-03-21 23:05:13 +00:00
Alfred Perlstein
b5749e6213 Remove main() prototype. 2002-03-21 22:53:49 +00:00
Alfred Perlstein
33314abe2c Remove __P. 2002-03-21 22:52:45 +00:00
Alfred Perlstein
4b4ec9b800 Fix boundry condition in lock management:
Alfred, I took a look at retry_blockingfilelocklist() and the
 solution seemed  simple enough. Please correct me if I am wrong.
 It seems said routine doesn't  take into account boundary conditions
 when putting back file_lock entries into the blocked lock-list.
 Specifically, it fails when the file_lock being put back is the
 last element in the list, and when it is the only element in the
 list.  I've included a patch below.

 Basically, it introduces another variable: pfl, which keeps track
 of the list  item before ifl. That way if nfl is NULL, ifl gets
 inserted after pfl. If pfl  is also NULL, then it gets inserted
 at the head of the list (since it was the  only element in the
 list).

Submitted by: Mike Makonnen <mike_makonnen@yahoo.com>
Tested by: Thomas Quinot <thomas@cuivre.fr.eu.org>
2002-01-17 00:12:05 +00:00
Alfred Perlstein
815ac49626 prototype functions and fix some line wrapping 2001-12-02 11:10:46 +00:00
Alfred Perlstein
8c7daee735 Fold ANDREW_LOCKD into -current. 2001-11-29 17:36:45 +00:00
Alfred Perlstein
5f07c7b294 This completes the all partial file locking under NFS. The underlying
file is still completely covered by a flock(2) style lock, but we'll tackle
that at a later date.

Submitted by: "Andrew P. Lentvorski" <bsder@allcaps.org>
2001-11-20 06:13:53 +00:00
Alfred Perlstein
b6dc41baf1 Cleanup.
use LIST_FOREACH,

add prototypes (functions should be made static probably),

change DEBUG=1 to LOCKD_DEBUG,

K&R function instantiation for functions with long args lists,

Move comments about functions from within to above the function,

Simplified some if/else logic and reduced nested blocks.

parens around 'return' argument (return FOO -> return (FOO))
2001-11-18 05:08:19 +00:00
Alfred Perlstein
a4a8a04d08 Re-enable statd code.
Submitted by: "Andrew P. Lentvorski" <bsder@allcaps.org>
2001-11-18 03:50:38 +00:00
Alfred Perlstein
7e589b0b6e This adds in the full HW locking capability and should now make my rewrite
of the rpc.lockd fully compliant with the old file locking semantics.

Andrew will dig into the statd code next and then will attack the split
locking.

This also backs out a lot of the work I've done on making the code
more conformant with non-written style rules, but we'll revisit that
later.

Submitted by: "Andrew P. Lentvorski" <bsder@allcaps.org>
2001-11-18 00:41:15 +00:00
Alfred Perlstein
4945c13244 Bring in Andrew P. Lentvorski initial work on making lockd work,
this should get us closer so cleaner implementation.

Submitted by: Andrew P. Lentvorski <bsder@allcaps.org>
2001-11-15 09:35:51 +00:00
Alfred Perlstein
2663693cf8 Turn on NO_WERROR and set WARNS to 1.
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.
2001-11-13 11:24:23 +00:00
Alfred Perlstein
a95a0d36d4 fix parameters to lock_answer().
Submitted by: Timo Geusch <freebsd@unix-consult.com>
2001-11-12 16:34:59 +00:00
Alfred Perlstein
755f5b77d8 Fixup for WARNS. 2001-11-12 16:29:45 +00:00
Alfred Perlstein
32e9a24903 Drop privs while servicing kernel lock requests.
Restore umask used before FIFO creation.
If opening the FIFO fails, exit.
Properly check the return value of open (use == -1 instead of < 0).
2001-11-11 23:40:10 +00:00
Alfred Perlstein
64b829d192 leverage fixed fifo implementation (rev 1.56 of
src/sys/fs/fifofs/fifo_vnops.c) to serve locks better, my previous
workaround for lack of decent fifo system wasn't cutting it,
particularly the kernel would send a message down the fifo and
immediately close it, this would lead to delayed unlock requests
being seen by the lockd causing all sorts of badness.

Basically, don't reopen the fifo, just select(2) on it.
2001-11-08 10:37:32 +00:00
Alfred Perlstein
9529c2d965 use syslog rather than printf so we can see what's going on in debug mode 2001-11-08 10:34:21 +00:00
Alfred Perlstein
955e10567c style fixes, fix line wrap and function declaration 2001-11-08 10:33:41 +00:00
Alfred Perlstein
bad584e319 Implement partial-file NFS lock testing.
Submitted by: "Andrew P. Lentvorski" <andrewl@io.com>
2001-10-14 18:36:35 +00:00
Peter Wemm
9119623471 Userland part of nfs client/server split and cleanup. 2001-09-18 23:34:44 +00:00
David E. O'Brien
90e655ea4e Perform a major cleanup of the usr.sbin Makefiles.
These are not perfectly in agreement with each other style-wise, but they
are orders of orders of magnitude more consistent style-wise than before.
2001-07-20 06:20:32 +00:00
Alfred Perlstein
c20e578f5a Distinguish between rpc version numbers in the client cache to avoid
replying on the wrong port.
2001-04-28 04:26:32 +00:00
Alfred Perlstein
de72020ec1 handles.c belonged to the old stub lockd, nuke it. 2001-04-28 02:19:15 +00:00
Alfred Perlstein
622d8a963c procs.c belonged to the old stub lockd, nuke it. 2001-04-28 02:17:33 +00:00
Ruslan Ermilov
ed7948b630 mdoc(7) police: Removed forgotten .Pp. 2001-04-27 10:18:22 +00:00
Alfred Perlstein
5f8568ec81 Fix compiling without -O, some dead code was using non-existant functions,
make the code not automatically dead but actually use the debug level
in order to determine if output is needed.  Fix non-existant from_addr()
by #define'ing it to inet_ntoa().

Remove hardcoded -g from Makefile.

Reported by: "John W. De Boskey" <jwd@bsdwins.com>
Tested by: "John W. De Boskey" <jwd@bsdwins.com>
2001-04-25 18:40:38 +00:00
Alfred Perlstein
3455a26dc3 Remove section from bugs that says we don't support client locks.
Pointed out by: Martin Blapp <mb@imp.ch>
2001-04-19 12:29:43 +00:00
Alfred Perlstein
b863595d52 remove debug code left in by accident 2001-04-18 21:41:27 +00:00
Alfred Perlstein
603c86672c Implement client side NFS locks.
Obtained from: BSD/os
Import Ok'd by: mckusick, jkh, motd on builder.freebsd.org
2001-04-17 20:45:23 +00:00
Ruslan Ermilov
345e52e742 - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:42:20 +00:00