Commit Graph

705 Commits

Author SHA1 Message Date
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