Commit Graph

261 Commits

Author SHA1 Message Date
jmg
caa72af181 convert some nfs tunables to options, these are:
NFS_MINATTRTIMO         VREG attrib cache timeout in sec
NFS_MAXATTRTIMO
NFS_MINDIRATTRTIMO      VDIR attrib cache timeout in sec
NFS_MAXDIRATTRTIMO
NFS_GATHERDELAY         Default write gather delay (msec)
NFS_UIDHASHSIZ          Tune the size of nfssvc_sock with this
NFS_WDELAYHASHSIZ       and with this
NFS_MUIDHASHSIZ         Tune the size of nfsmount with this
NFS_NOSERVER            (already documented in LINT)
NFS_DEBUG               turn on NFS debugging

also, because NFS_ROOT is used by very different files, it has been
renamed to opt_nfsroot.h instead of the old opt_nfs.h....
1998-06-30 03:01:37 +00:00
bde
feb3b094a7 Fixed typo in ifdefed code. (NFS_ACDEBUG is not in LINT. Therefore,
code controlled by it did not even compile.)
1998-06-21 12:50:12 +00:00
bde
9beca6bfbc Avoid an egcs pessimization for 64-bit signed division on i386's.
Pre-2.8 versions of gcc generate a call to __divdi3() for all 64-bit
signed divisions, but egcs optimizes them to a shift and fixup when
the divisor is a constant power of 2.  Unfortunately, it generates
a call to __cmpdi2() for the fixup, although all except possibly
ancient versions of gcc and egcs do ordinary 64-bit comparisons
inline.
1998-06-14 15:52:00 +00:00
dfr
92449ad5fa This commit fixes various 64bit portability problems required for
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.
1998-06-07 17:13:14 +00:00
peter
7d519e2203 Make sure we go a nfs_fsinfo() in get/putpages before calling
readrpc/writerpc, since they assume it's already been done.  This could
break if the first read/write access to a nfs filesystem was an exec() or
mmap() instead of a read(), write() syscall.  (or statfs()).
nfs_getpages() could return an errno (EOPNOTSUPP) instead of a VM_PAGER_*
return code.  Some layout tweaks for the get/putpages code.
1998-06-01 11:32:53 +00:00
peter
b1ce849a05 Fix post-test pre-commit cleanup typo. 1998-06-01 11:07:16 +00:00
peter
d2ca298269 readlink() returns EINVAL rather than EPERM if called on a non-symlink. 1998-06-01 10:59:23 +00:00
peter
c0e6bda9ea Preset the maximum file size before we get to nfs_fsinfo(), based on
an (over?) conservative assumption about what the client can store in it's
buffer cache using a signed 32-bit 512-byte block number index.  Otherwise
it's possible for some file access when maxfilesize = 0 (eg: /usr is nfs
mounted and doing an execve())
Pointed out by:	 bde

XXX It might make sense to do a preemptive nfs_fsinfo() call at mount time.
1998-06-01 10:01:31 +00:00
peter
f74a201183 For the on-the-wire protocol, u_long -> u_int32_t; long -> int32_t;
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
1998-05-31 20:09:01 +00:00
peter
692d47eec9 Support 'mount -u' remounts. This may require disconnecting and rebinding
the socket.  Certain mode changes are not allowed.

Obtained from:  NetBSD
1998-05-31 19:49:31 +00:00
peter
ff45fa255d xdr encode -1 properly.
Obtained from: NetBSD
1998-05-31 19:29:28 +00:00
peter
2987193b30 Fully fill in nfsv2 write rpc requests rather than leaving garbage.
Obtained from: NetBSD
1998-05-31 19:28:15 +00:00
peter
9a4322a2d0 Don't silently fail to set file flags.
Obtained from:  NetBSD
1998-05-31 19:24:19 +00:00
peter
c531dc87c6 Don't blindly accept the server's preferences if they are too small.
Obtained from:  NetBSD
1998-05-31 19:20:44 +00:00
peter
d46a21d4ce Prototype support for selectively allowing non-reserved ports on a per
export basis.  Needs userland support yet.

Obtained from:  NetBSD
1998-05-31 19:16:08 +00:00
peter
8eceafffb2 Don't pass a second copy of the uid/gid in with the v2/v3 sattr structures,
it just makes more work.  We pass a copy of the uid/gid with the
credentials.  (although, this may need to be revisited if a non AUTHUNIX
authentication method (such as NFSKERB) ever gets implemented).

Obtained from:  NetBSD
1998-05-31 19:00:19 +00:00
peter
434d53c8c0 Use the new SB_UPCALL flag,
Obtained from:  NetBSD (but I changed the flag clear order in case).
1998-05-31 18:46:06 +00:00
peter
f7f311c40b NFS_SMALLFH is defined in nfsproto.h, not sys/mount.h
Obtained from:  NetBSD
1998-05-31 18:32:23 +00:00
peter
624a676561 Don't let the user try "rmdir ."
Obtained from:  NetBSD
1998-05-31 18:30:42 +00:00
peter
cc573f4f48 Don't let the user try and unlink() a directory on a NFS server.
Obtained from:  NetBSD
1998-05-31 18:28:45 +00:00
peter
6bcfa0ac79 When a write rpc returns an error, break the loop.
Obtained from: NetBSD
1998-05-31 18:27:07 +00:00
peter
695d7683f9 Don't leak an mbuf when a write rpc returns zero bytes written.
Obtained from: NetBSD
1998-05-31 18:25:32 +00:00
peter
5c3c04f77a #ifdef a diagnostic printf
Obtained from:  NetBSD
1998-05-31 18:23:24 +00:00
peter
c16cfc54ff Don't try and free mrep twice on some error conditions.
Obtained from:  NetBSD
1998-05-31 18:19:43 +00:00
peter
5223619fcd #ifdef a diagnostic panic, plus another missed costmetic change.
Obtained from:  NetBSD
1998-05-31 18:11:03 +00:00
peter
e6c2fb9a1e We have gained 2 more errno's, add them to the NFSv2 mapping table. 1998-05-31 18:09:18 +00:00
peter
63de139aff Missed a cosmetic change that the other BSD's have. 1998-05-31 18:08:09 +00:00
peter
2929d04ecf oops, nfs_msg() is called from client code too. 1998-05-31 18:06:07 +00:00
peter
a6a122d71b When we can't reconnect a socket, don't forget to unlock before retrying
or we can deadlock.

Obtained from:  NetBSD
1998-05-31 18:02:56 +00:00
peter
76064558f0 Don't log zero length reads, this can happen during normal operation.
Obtained from: NetBSD
1998-05-31 18:00:46 +00:00
peter
4183d70dd3 Consider for readdir chunk sizes when tuning socket buffer reservations.
Obtained from:  NetBSD
1998-05-31 17:57:43 +00:00
peter
353bcc0c75 Some const's
Obtained from: NetBSD
1998-05-31 17:48:07 +00:00
peter
cbaa5d2256 NFS Jumbo commit part 1. Cosmetic and structural changes only. The aim
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.
1998-05-31 17:27:58 +00:00
peter
3b0d915f97 VOP_ABORTUP() appears to be called with the wrong vnode. The other callers
that I checked (eg: ufs_link()) do the ABORTOP on the directory rather than
the file itself.  After Michael Hancock's patches, the abortop doesn't seem
all that critial now since something else will free the pathname buffer.
1998-05-31 01:03:07 +00:00
peter
432cd8e2e7 When using NFSv3, use the remote server's idea of the maximum file size
rather than assuming 2^64.  It may not like files that big. :-)
On the nfs server, calculate and report the max file size as the point
that the block numbers in the cache would turn negative.
(ie: 1099511627775 bytes (1TB)).

One of the things I'm worried about however, is that directory offsets
are really cookies on a NFSv3 server and can be rather large, especially
when/if the server generates the opaque directory cookies by using a local
filesystem offset in what comes out as the upper 32 bits of the 64 bit
cookie.  (a server is free to do this, it could save byte swapping
depending on the native 64 bit byte order)

Obtained from:	NetBSD
1998-05-30 16:33:58 +00:00
peter
adcdd6ebdb Convert a couple of large allocations to use zones rather than malloc
for better packing.  This means that we can choose better values for the
various hash entries without having to try and get it all to fit within
an artificial power of two limit for malloc's sake.
1998-05-24 14:41:56 +00:00
peter
fb32317974 s/flags/flag/ 1998-05-20 08:05:45 +00:00
peter
de5055805c A cleaner fix for PR#5102, clear nonsense flags at mount time rather than
in the core of nfs_bio.c at the 11th hour.

PR:		5102
1998-05-20 08:02:24 +00:00
peter
b4c1590661 Don't change argp->flags after it's been copied. 1998-05-20 07:59:21 +00:00
peter
8c1d4bd15f Allow control of the attribute cache timeouts at mount time.
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.
1998-05-19 07:11:27 +00:00
bde
544ba257e4 Get timespecs directly instead of via timevals. 1998-05-16 16:20:50 +00:00
bde
d87f73393d Don't abuse `+' to combine flags. 1998-05-16 16:03:10 +00:00
bde
886e4ee4a1 Backed out rev.1.76. It just added style bugs. 1998-05-16 15:21:29 +00:00
bde
f72c46e826 Get timespecs directly instead of via timevals. 1998-05-16 15:11:24 +00:00
peter
4005649c78 Add missing arg to vget().. Serves me right for committing a 2.2 patch to
-current without testing it there.. :-(

Submitted by: Michael Hancock <michaelh@cet.co.jp>
1998-05-13 07:49:08 +00:00
peter
bc2286faf9 Hold a reference to the vnode during the sillyrename cleanup. If we block
in nfs_vinvalbuf() or the nfs_removeit(), we can have the nfsnode reallocated
from underneath us (eg: replaced by a ufs 'struct inode') which can cause
disk corruption ('freeing free block' when di_db[5] gets trashed).
This is not a cheap fix, but it'll do until the nfsnodes get reference
counting and/or locking.

Apparently NetBSD have a similar fix (apparently from BSDI).

I wish all PR's had this much useful detail. :-)

PR: 6611
Submitted by: Stephen Clawson <sclawson@marker.cs.utah.edu>
1998-05-13 06:10:13 +00:00
peter
aa1955d6ea Move the *vpp initialization earlier so that it's set in all error cases.
This should stop the 'panic: leaf should not be empty' nfs panic.

PR: 1856
Submitted by: msaitoh@spa.is.uec.ac.jp
1998-05-13 05:47:09 +00:00
msmith
b4bbf78c74 In the words of the submitter:
---------
Make callers of namei() responsible for releasing references or locks
instead of having the underlying filesystems do it.  This eliminates
redundancy in all terminal filesystems and makes it possible for stacked
transport layers such as umapfs or nullfs to operate correctly.

Quality testing was done with testvn, and lat_fs from the lmbench suite.

Some NFS client testing courtesy of Patrik Kudo.

vop_mknod and vop_symlink still release the returned vpp.  vop_rename
still releases 4 vnode arguments before it returns.  These remaining cases
will be corrected in the next set of patches.
---------

Submitted by:	Michael Hancock <michaelh@cet.co.jp>
1998-05-07 04:58:58 +00:00
msmith
54f95d7f2a As described by the submitter:
Reverse the VFS_VRELE patch.  Reference counting of vnodes does not need
to be done per-fs.  I noticed this while fixing vfs layering violations.
Doing reference counting in generic code is also the preference cited by
John Heidemann in recent discussions with him.

The implementation of alternative vnode management per-fs is still a valid
requirement for some filesystems but will be revisited sometime later,
most likely using a different framework.

Submitted by:	Michael Hancock <michaelh@cet.co.jp>
1998-05-06 05:29:41 +00:00
phk
b3b6700ad6 Use random() to find our initial xid. 1998-04-06 11:41:07 +00:00