Commit Graph

801 Commits

Author SHA1 Message Date
yamt b0ac3e4201 nfsrv_zapsock: fix an inverted condition in nfs_syscall.c rev.1.74. 2004-06-10 12:57:43 +00:00
yamt 7407c491c3 nfsrv_create: fix an LP64 problem for exclusive create. 2004-05-31 08:47:08 +00:00
yamt ee306471a7 remove an unused instance of VOP_UPDATE. 2004-05-27 12:55:07 +00:00
hannken 8c21bc6224 Add ffs internal snapshots. Written by Marshall Kirk McKusick for FreeBSD.
- Not enabled by default. Needs kernel option FFS_SNAPSHOT.
- Change parameters of ffs_blkfree.
- Let the copy-on-write functions return an error so spec_strategy
    may fail if the copy-on-write fails.
- Change genfs_*lock*() to use vp->v_vnlock instead of &vp->v_lock.
- Add flag B_METAONLY to VOP_BALLOC to return indirect block buffer.
- Add a function ffs_checkfreefile needed for snapshot creation.
- Add special handling of snapshot files:
    Snapshots may not be opened for writing and the attributes are read-only.
    Use the mtime as the time this snapshot was taken.
    Deny mtime updates for snapshot files.
- Add function transferlockers to transfer any waiting processes from
  one lock to another.
- Add vfsop VFS_SNAPSHOT to take a snapshot and make it accessible through
  a vnode.
- Add snapshot support to ls, fsck_ffs and dump.

Welcome to 2.0F.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-05-25 14:54:55 +00:00
atatat 53c625655c Sysctl descriptions under vfs subtree 2004-05-25 04:44:43 +00:00
jonathan 20f923718e Change DIAGNOSTIC warning in nfs_send() about NULL rep->r_procp: the
warning is triggered pervasively, so print it only once per boot.
(The callers who pass NULL r_procps should soon be fixed to pass a
valid struct proc* ).
2004-05-24 19:08:07 +00:00
yamt 345a3c375d - for tcp, use SO_RCVTIMEO to recover from server crash.
otherwise we can be stuck in soreceive forever.
  the problem is pointed by Minoura Makoto.  PR/25662
- clear r_rexmit on reconnect and clear r_rtt and R_TIMING on retransmit
  so that the above (and soft mounts) happy.
2004-05-23 08:08:48 +00:00
christos 45fb41a2bd cut down another 7K by more NFS_V2_ONLY ifdefs. 2004-05-23 05:53:01 +00:00
jonathan 230fb9b8ab Eliminate several uses of `curproc' from the socket-layer code and from NFS.
Add a new explicit `struct proc *p' argument to socreate(), sosend().
Use that argument instead of curproc. Follow-on changes to pass that
argument to socreate(), sosend(), and (*so->so_send)() calls.
These changes reviewed and independently recoded  by Matt Thomas.

Changes to soreceive() and (*dom->dom_exernalize() from Matt Thomas:
pass soreceive()'s struct uio* uio->uio_procp to unp_externalize().
Eliminate curproc from unp_externalize.   Also, now soreceive() uses
its uio->uio_procp value, pass that same value downward to
((pr->pru_usrreq)() calls for consistency, instead of (struct proc * )0.

Similar changes in sys/nfs to eliminate (most) uses of curproc,
either via the req-> r_procp field of a struct nfsreq *req argument,
or by passing down new explicit struct proc * arguments.

Reviewed by: Matt Thomas, posted to tech-kern.
NB: The (*pr->pru_usrreq)() change should be tested on more (all!) protocols.
2004-05-22 22:52:13 +00:00
yamt 7a6774551d enable reply cache for connection oriented protocols as well.
linux retransmits rpcs even when using tcp.
2004-05-21 13:53:40 +00:00
yamt 92e4dbdd94 #if 0 out CREATE optimization for now because it has a problem in the case
of O_CREAT|O_TRUNC, which is hard to be fixed without changing upper layer.
2004-05-17 12:17:18 +00:00
yamt 8d2f96d0fc g/c unused NFS_*ALLOC defines. 2004-05-12 20:11:27 +00:00
yamt 75f99c3465 nfs_lookup: handle "." by ourselves as RFC1813 3.2 says. 2004-05-10 12:43:51 +00:00
yamt 2dd754b680 don't do kludge for a reply to a retransmitted request
unless we actually retransmitted the request.
2004-05-10 10:40:42 +00:00
yamt 1c1b12397d nfs_lookup: avoid CREATE optimization for DOTDOT.
creating a DOTDOT entry has no sense and will fail anyway.
2004-05-08 21:35:13 +00:00
yamt 48e8239c5a nfs_mkdir: handle the "." case. 2004-05-08 21:33:41 +00:00
yamt 2890b70316 nfs_lookitup: handle "." correctly rather than returning garbage on the stack. 2004-05-08 21:32:34 +00:00
yamt 52fedf49f0 check read only mount appropriately.
(fix a bug of nfs_vnops.c rev.1.192.)
pointed by Rob Quinn on current-users@.
2004-05-07 16:09:46 +00:00
yamt 2a85a8c4fd because nfsv3 has the same CREATE semantics as ours,
we don't have to issue LOOKUP RPCs beforehand.
2004-05-06 21:58:17 +00:00
drochner 264eb6a8ba remove duplicated snprintf(vci, ...) 2004-05-06 12:32:59 +00:00
matt adc905e2c4 Commons are not allowed in header files. extern it. 2004-05-01 06:16:42 +00:00
jrf fc97fd571a First pass for some caddr_t removal and changes to get rid of it where we
no longer use and/or need it

	- removed casts from unionfs, deadfs and fdesc
	  (there are more to hunt down still)
	- changed vfs_quotactl args argumet from caddr_t to void *
	- changed vfs_quotactl structures/callers to reflect the api change

Compiled fine and ran for about a day. Approved/reviewed by
christos@netbsd.org and gimpy@netbsd.org.
2004-04-27 17:37:30 +00:00
simonb b5d0e6bf06 Initialise (most) pools from a link set instead of explicit calls
to pool_init.  Untouched pools are ones that either in arch-specific
code, or aren't initialiased during initial system startup.

 Convert struct session, ucred and lockf to pools.
2004-04-25 16:42:40 +00:00
itojun d2f1c029b9 kill sprintf, use snprintf 2004-04-21 18:40:37 +00:00
christos baf95c5d08 use VFS_MAXFIDSZ 2004-04-21 02:22:49 +00:00
christos 6bd1d6d4db Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
2004-04-21 01:05:31 +00:00
yamt 392d6f9af1 nfs_inactive: inactive the vp before doing sillyrename works.
vp can be reclaimed soon after it's unlocked.
2004-04-20 11:51:28 +00:00
yamt d1a0f61a77 nfs_readdirplusrpc: fix a deadlock problem.
don't wait for vnode lock to load attributes.
otherwise, because READDIRPLUS returns DOTDOT entry as well,
we violate locking order.
2004-04-05 10:44:09 +00:00
yamt a3a3d45be7 nfsm_mtofh: handle the case that filehandle is exist but fattr is not. 2004-04-05 10:41:45 +00:00
yamt 9ec3dce770 don't issue VOP_GETATTR blindly in nfs_nget().
in many cases, GETATTR RPCs here is redundant because the caller has
postop_attr.  instead, make sure the resulted vnode have a valid
attribute in nfs_lookup().
2004-04-05 10:40:56 +00:00
yamt 04e9fcc377 nfs_readdirplusrpc: purge existing namecache entry before entering a new one.
otherwise we'll get duplicated entries.
2004-04-05 10:36:32 +00:00
yamt 757220a432 when entering a namecache entry for nfs, ensure to update the appropriate
timestamp in the nfsnode so that we don't get namecache-miss when
looking up the node we just created.
2004-04-05 10:35:12 +00:00
yamt 0f33822b0b nfsm_wcc_data: update n_ctime and n_nctime if no one other than us
changed the file in the meantime so that we won't invalidate caches
unnecessarily due to our own activities.
2004-04-05 10:28:23 +00:00
yamt f2fb72c33f avoid unnecessary namecache purges in some places. 2004-04-05 10:27:11 +00:00
atatat 19af35fd0d Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
2004-03-24 15:34:46 +00:00
yamt aefad8a7e8 nfs_getattrcache: deal with timer wraparound. 2004-03-19 13:53:28 +00:00
yamt 0f554e4324 comments on some nfsm_ macros. 2004-03-19 13:52:07 +00:00
yamt a2d33a3097 nfsrv_zapsock: zap an nfsd socket only if it's valid. 2004-03-17 10:43:35 +00:00
yamt 995e6c528b nfsrv_zapsock: remove slp from nfssvc_sockpending before zapping. 2004-03-17 10:42:37 +00:00
yamt ec3b565db1 nfs_sndlock: fix nfsd null dereference. 2004-03-17 10:40:34 +00:00
yamt fd4b77d30f SHUT_RDWR rather than bare 2. 2004-03-17 10:37:02 +00:00
yamt c12b63c2e0 some comments on cryptic nfsm_ macros. 2004-03-15 11:47:52 +00:00
yamt c819fadc97 shrink sizeof struct nfsnode by putting exclusive members into union. 2004-03-12 16:52:37 +00:00
yamt a4cbf5b042 introduce a macro NFS_INVALIDATE_ATTRCACHE and use it
instead of "n_attrstamp = 0".
2004-03-12 16:52:14 +00:00
cl 638599b22b Add static nfs boot configuration, from the kernel config file or from
a driver selectable callback function.  This is used in the Xen port to
allow controlling  the domain's network setup from the domain building
environment at domain creation (vs. having to maintain/change this on a
dhcp server).  The Xen network driver parses a command line passed in
from the domain builder.
2004-03-11 21:48:43 +00:00
matt d377ba32b7 Don't report EPIPE errors on nfs sockets. These can be due to idle tcp
mounts which will be closed by netapp, solaris, etc. if left idle too long.
2004-03-10 22:36:42 +00:00
wrstuden b5053f07a1 Adjust sillyrename cleanup code to deal with the parent vnode
already being locked by our thread. VOP_INACTIVATE() makes no
statement as to the lock state of the parent, yet this code assumed
we had it unlocked.

With this change, we let vn_lock() fail with EDEADLK if we already
have the parent locked. We then handle the rename cleanup, and on
the way out just vrele() the parent vnode, not vput() it.

Fixes a case seen by Steve Woodford at Wasabisystems dot com where
we'd panic while running a pkgsrc configure test that verified
fork() functionality. I expect the problem is a result of the recent
exit() changes and the performance of the machines he tested on.

Specifically we would crash during an nfs_remove(). As best I can
tell, when nfs_remove() tested to see if we should rename or we
should remove, v_usecount was > 1 and vattr.va_nlink was 1. Thus
we did the sillyrename in nfs_remove(). However by the time we got
down to the vput(vp), v_usecount had dropped to one and thus vput()
triggered the VOP_INACTIVATE() code path. nfs_inactive() tries to
lock the parent to undo the sillyrename, and deadlocks as we still
have it locked.
2004-01-23 22:20:20 +00:00
yamt 5abccc6a0c comments in nfs_doio_write. 2004-01-10 14:52:53 +00:00
yamt 59afac32fe - get pages to loan out in uvm_loanuobjpages() rather than
having caller (nfsd, in this case) do so.
- tweak locking so that nfs loaned READ works on layered filesystems.
2004-01-07 12:17:10 +00:00
fvdl b916f59963 Unix semantics dictate that access checks for files are done when it
is opened. An open file can always be read from and/or written to,
depending on how it was opened.

Therefore, the read/write/commit RPCs should never return EACCESS,
as they are only performed on files that have been successfully opened
already.

This change improves the current situation and works in most cases.
It simply always uses the most recently known owner/group of the file,
iff the authentication mechanism is AUTH_UNIX (in other cases, the
creds for a succesful open are used, but note that no other cases
are currently implemented).

A retry mechanism can be used to catch a few more cases, but this is
a good improvement for now.
2003-12-07 21:15:46 +00:00
thorpej fbc2b3fcd3 Fix a couple of small whitespace errors. 2003-12-07 18:58:11 +00:00
jonathan 47eb5abfab Commit message for previous revision to sys/nfs/nfs.h:
Increase NFS_MAXRAHEAD to 32. With 32k read or write requests, that
amounts to 1 Mbyte of read-ahead, enough to cover about 10 ms latency
at gigabit Ethernet speeds.  Increase the table of nfsiod kthreads
(NFS_MAXASYNCDAEMON) from 20 to 128, to match the raised value of
NFS_MAXRAHEAD. (Making the limit dynamic requires   replacing the
compile-time array with a dynamic structure.)

Add a comment explaining that each read-ahead requires an I/O thread.

Wrap both parameters with an #ifdef <parameter>/#endif, to allow
hand-tuned values or (later) a kernel config-file option override.
2003-12-06 02:48:35 +00:00
jonathan 8f814572a8 *** empty log message *** 2003-12-06 02:43:17 +00:00
atatat 13f8d2ce5f Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al.  Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded.  Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment.  I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 19:38:21 +00:00
yamt 32e454901e nfs_zeropad: remove an unneeded substitution (and clean up a little.) 2003-11-29 19:31:13 +00:00
yamt 4e8d9fe867 pad requests correctly in the zerocopy case of write rpc. 2003-11-29 19:27:57 +00:00
yamt 348187802d comments. 2003-11-20 16:18:49 +00:00
yamt 0b47e1b287 fix a race case of nfsrv_getcache. 2003-11-20 16:17:25 +00:00
jonathan 30cbe1194d Fix hanging-paren typo. 2003-11-17 02:02:31 +00:00
jonathan cc1346b1a2 Change previous patch to have same effect as patch posted to
tech-kern. Suggested reformatting inadvertently changed the meaning of
the code, as noted by YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>.
2003-11-17 01:44:49 +00:00
jonathan 6ddd119256 Commit fix for NFS write deadlock, on filesystems mounted via
local-loopback (lo0). As posted for review on tech-kern 2003-18-09,
with a long  comment explaining (one of) the deadlock scenarios.

I've used this since shortly after 2002-09-12-, without noticing
performance degradataion or instability for non-loopback mounts.
2003-11-17 00:28:32 +00:00
hannken 2ef662a69e Clean up the usage of vn_start_write(). At least one occurence clobbered
previous error conditions.
If "(flags & (V_WAIT|V_PCATCH)) == V_WAIT" the return value is always zero.
Ignore the return value in these cases.

From Darrin B. Jewell.
2003-11-05 10:18:38 +00:00
simonb a2facef339 Remove some assigned-to but otherwise unused variables. 2003-10-30 01:43:08 +00:00
mycroft 3fbc866a6e Back out the bogus initializer -- the compiler bug is fixed. 2003-10-29 21:26:43 +00:00
cl b8d68ee313 note 'm68k {u,}int64_t used uninitialized' bug.
add reference to gcc bug report.
mark all (known) occurrences.
2003-10-28 02:01:46 +00:00
christos fe659fa011 fix uninitialized variable 2003-10-25 08:48:11 +00:00
yamt f3f1661306 set READres EOF flag correctly. 2003-10-20 13:53:47 +00:00
hannken a3a898ff0f Add the gating of system calls that cause modifications to the underlying
file system.
The function vfs_write_suspend stops all new write operations to a file
system, allows any file system modifying system calls already in progress
to complete, then sync's the file system to disk and returns. The
function vfs_write_resume allows the suspended write operations to
complete.

From FreeBSD with slight modifications.

Approved by: Frank van der Linden <fvdl@netbsd.org>
2003-10-15 11:28:59 +00:00
yamt f2aa877507 for nfs_timer_ch, use callout_schedule rather than callout_reset
as the former is a little more efficient.
2003-10-09 13:23:33 +00:00
yamt 589e82f2ba terminate snprintb 'new' format strings correctly.
(fixes overrun in mount_*)
2003-10-03 16:34:31 +00:00
itojun ea3d98658c plug mbuf leak due to manual mbuf handling. PR kern/13807.
(martti confirmed that it stabilizes the situation described in kren/13807)
2003-10-02 06:01:51 +00:00
yamt ef98d23ce3 do delayed truncation in nfs_getattr. 2003-09-26 14:08:45 +00:00
yamt c2025ab0ea change n_mtime from time_t to timespec in order to improve
cache consistency.
(1 second granularity is too loose these days.)
2003-09-26 11:51:53 +00:00
enami e027b9d372 Make negative name cache works again. 2003-09-25 23:10:58 +00:00
yamt 883426c958 don't call nfs_delayedtruncate() from nfs_getpages().
it causes simplelock deadlock.
2003-09-17 09:11:12 +00:00
yamt 1e8ae1ddf3 change nctime to timespec from time_t.
there can be too many activities in a second.
2003-09-17 09:10:00 +00:00
pk e881551a43 VOP_PUTPAGES() must be called with the vnode's interlock held. 2003-08-26 16:40:10 +00:00
yamt 1877d60129 use sizeof() instead of a hardcorded constant. 2003-08-16 18:09:14 +00:00
yamt 3fcbf88d41 current trylater/jukebox retry delay is way too long and
it has a bug in the backoff calculation. so,
- clip it to 1-60 sec. (suggested by Rick Macklem)
- use a constant multiplier instead of nfs_backoff, which
  is already exponential.
- move some related constant definations to nfs.h from nqnfs.h and
  prefix with NFS_ instead of NQ_ because they are not nqnfs-specific.
2003-08-16 18:08:27 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
pk 09f1c82201 Make life slightly easier for the compiler's optimisation routines. 2003-08-03 18:20:53 +00:00
yamt 33164bffc6 vrecycle removed nfs vnodes.
not perfect, but enough for most cases.
2003-07-30 12:25:39 +00:00
yamt cc104d0635 eliminate v_id. 2003-07-30 12:10:57 +00:00
yamt 7bb74d0662 when rexmitting a request due to NFSERR_JUKEBOX,
use a new xid as RFC1813 says.
2003-07-23 13:52:23 +00:00
yamt 6b565018de fix parenthesis mismatch in rev.1.93. 2003-07-23 13:50:46 +00:00
yamt 9985a5ca73 use sizeof() instead of hardcoding the size of the array. 2003-07-23 13:41:00 +00:00
bouyer a678ebca13 nfsrv_commit(): return success and don't do anything for requests which starts
past the end of the file. This can happen when two clients are writting to
the same file.
Close PR 21696 by myself, discussed on tech-net in 2003/05 and 2003/06.
Issue raised by Chuck Silvers (commit and truncate ops needs to be serialised)
still unadressed.
2003-07-09 21:16:12 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
thorpej a06b275edc Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget().  Turns out
  that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
  and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
  above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
  just to appease the above.
2003-06-29 18:43:21 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
yamt ff974db6fd if nfs_writerpc() splitted an unstable write into some rpcs and
write verifier was changed, we should restart from the first.
2003-06-27 14:00:55 +00:00
yamt 42be09ca92 indent. 2003-06-27 13:58:36 +00:00
yamt f2917653ff add appropriate #ifdef's.
pointed by Simon Burge on source-changes
and by some people in private mail.
2003-06-26 13:38:53 +00:00
yamt 45c519f76f - instead of scaning a list when looking up
{a idle thread, a socket with pending requests},
  maintain dedicated list of them.
- add spin locks.
2003-06-25 14:37:50 +00:00
martin d505b18964 Make sure to include opt_foo.h if a defflag option FOO is used. 2003-06-23 11:00:59 +00:00
yamt 9c329a66d1 rework zero padding of rpc reply.
- for READ procedure, don't send back more bytes than requested.
- don't have doubtful assumptions on mbuf chain structure.
- rename a function (nfsm_adj -> nfs_zeropad) to avoid confusion as
  the semantics of the function was changed.
2003-06-09 13:10:31 +00:00
yamt bcf2e4f22f fix a problem in 'protected' case of writerpc.
retransmitted mbufs can survive even after requests themselves
finished.  so, before unbusy pages, make sure that mbufs referring them
go away.

pointed by enami tsugutomo on port-mips.
2003-06-03 14:27:48 +00:00
yamt 85d0052723 workaround for UBC limit.
while our nfsd announces MAXBSIZE as wtmax for tcp,
VOP_GETPAGES of filesystems that uses genfs_getpages can't
handle >= MAX_READ_AHEAD(16) pages at once.
therefore, depending on PAGE_SIZE of the machine and file offset of
a read request, we can't VOP_GETPAGES the range at once.
2003-05-29 15:18:14 +00:00
yamt d36494e29b fix a memory leak bug that i introduced in rev.1.167.
patch provided by enami tsugutomo on current-users.
2003-05-27 14:41:06 +00:00
yamt a340c1b544 when a result of NFSv3 READLINK is too long for us,
return ENAMETOOLONG rather than EBADRPC.
(it's our implementation limit, not protocol limit.)
2003-05-26 13:34:38 +00:00