Commit Graph

937 Commits

Author SHA1 Message Date
blymn 10df330c85 Prefix iostat structure elements with io_ 2006-04-20 12:13:51 +00:00
christos de6470e701 m_freem takes one arg. 2006-04-15 02:49:25 +00:00
christos 2fd9c5d744 s/mfree/m_freem/ 2006-04-15 02:48:32 +00:00
dogcow bbfbd3e91f #if -> #ifdef 2006-04-15 02:46:39 +00:00
christos f540054634 Coverity CID 735: Remove duplicate code. 2006-04-15 01:58:44 +00:00
christos 0b55b29a78 Coverity CID 734: Define NFS_TEST_HEAVY for testing nfsds, and use this to
ifdef out dead code. XXX: Why is this turned on by default?
2006-04-15 01:57:36 +00:00
christos 4ea21306a7 Coverity CID 736: Comment out dead code. 2006-04-15 01:54:46 +00:00
christos 0016be6042 Coverity CID 1175: Remove dead code. 2006-04-15 01:52:44 +00:00
christos 1ee078d67e Coverity CID 744: Conditionally define out dead code (only if it is dead) 2006-04-15 01:51:47 +00:00
christos 35829d71d3 Coverity CID 1141: Add a KASSERT before deref. 2006-04-15 01:45:15 +00:00
christos c3a65fd394 Coverity CID 1142: Add a KASSERT before deref. 2006-04-15 01:41:46 +00:00
christos d008757117 Coverity CID 1143: Prevent NULL deref. 2006-04-15 01:39:15 +00:00
christos 09436af99e Coverity CID 1144: Protect against NULL deref. 2006-04-15 01:37:46 +00:00
christos 6668c9c154 Coverity CID 1162: Prevent NULL deref. 2006-04-15 01:35:12 +00:00
christos b31d7b8b49 Coverity CID 1165: Cannot have nfsiod without an lwp, so remove the superfluous
test.
2006-04-15 01:31:11 +00:00
christos b2bd561652 Coverity CID 2445: Only set from_p if we succeed so that we free it on error. 2006-04-15 01:25:54 +00:00
christos bd57687667 Don't leak mbufs on error. 2006-04-15 01:25:01 +00:00
christos 6555ff0ad3 From my posting of April 3 to tech-kern:
My understanding is that the CLRSIG() is supposed to clear the signal
that was sent to the syncer process to prevent it from being delivered
to the syncer process in case unmounting fails, so that the syncer process
does not die while the filesystem is still mounted. The typical scenario
is, the syncher process is tsleep()ing in the kernel, and waking up when
it needs to do work. If someone sends a signal to it, eg. kill -TERM
the mfs process, then the kernel will try to unmount the mfs filesystem
before delivering the signal to the process. If that unmount fails, then
we should not really kill the process because that will hang the mount.
So we call CLRSIG() to stop the signal from being delivered.

So the first call to issignal() will return the signal number that was
sent to the syncer process (unless someone malicious was able to send
a lower numbered signal between the time tsleep() returned and we called
issignal()... something that is not really easy to do). But you are
right, we should not be calling it many times as a side effect of this
macro.

Rewrite CLRSIG() clear all the signals and call issignal() the correct
number of times.
2006-04-15 01:16:40 +00:00
christos 881fbaa328 Coverity CID 2509: Initialize cache 2006-04-15 00:45:49 +00:00
christos ff33272e7b Coverity CID 2510-2514: Always initialize cache. 2006-04-15 00:44:18 +00:00
christos 4c9d749d77 Coverity CID 2515-2519: Initialize rexmit on error path. 2006-04-15 00:40:20 +00:00
christos 1099609bd0 Coverity CID 2520: rexmit can be uninitialized on error path. 2006-04-15 00:36:23 +00:00
blymn 3c0adb7d99 Make i/o statistics collection more generic, include tape drives and
nfs mounts in the set of devices that statistics will be reported on.
2006-04-14 13:09:05 +00:00
yamt c5fcdd1719 some cleanups after the introduction of GOP_SIZE_MEM flag.
- remove GOP_SIZE_READ/GOP_SIZE_WRITE flags.
  they have not been used since the change.
- ufs_balloc_range: remove code which has been no-op since the change.
  thanks Konrad Schroder for explaining the original intention of the code.
- ffs_gop_size: don't extend past eof, in the case of GOP_SIZE_MEM.
  otherwise genfs_getpages end up to allocate pages past eof unnecessarily.
2006-03-30 12:40:06 +00:00
martin d6d75eaf5d KASSERT that the returned file id length from VPTOFH is <= the
maximum allowed value (_VFS_MAXFIDSZ).
2006-03-27 20:20:45 +00:00
christos c92b23ffa8 Don't use DEBUG, add a new DEBUG_NFS_BOOT_DHCP variable to provide more
information. Print more information about what fails.
2006-03-16 15:55:20 +00:00
yamt 6bf35dc8ec bump NFS_MAXDGRAMDATA from 32k to 60k. (ie. near the protocol limit of udp.)
- it can help performance for some environments.
- administrators should be free to do silly things. :-)
2006-03-14 03:23:23 +00:00
rpaulo 5bb59eeab9 Back out revision 1.125 and 1.124. The code for checking if
slp->ns_reclen == 0, was already there since "Linux sometimes
generates 0-lenght records.".

Bad Rui...
2006-03-01 21:31:00 +00:00
rpaulo 52dc289cfd In nfsrv_getstream(), ns_reclen will never be negative due to the
previous assignment (recmark & ~0x80000000).
Pointed out by Christos.
2006-03-01 19:38:29 +00:00
rpaulo b948e12637 From FreeBSD SA-06:10
Correct a remote kernel panic when processing zero-length RPC records
	via TCP.
2006-03-01 15:30:12 +00:00
yamt ec5a93183a merge yamt-uio_vmspace branch.
- use vmspace rather than proc or lwp where appropriate.
  the latter is more natural to specify an address space.
  (and less likely to be abused for random purposes.)
- fix a swdmover race.
2006-03-01 12:38:10 +00:00
thorpej 58853410ae Use device_class() instead of accessing dv_class directly. 2006-02-21 04:32:38 +00:00
yamt dae53410a7 - tweak RUN_ONCE api to allow init_func returns an error.
- physio: handle failure of workqueue_create.
2006-01-16 21:45:38 +00:00
yamt cabee93abb nfs_doio_read: clear uio_resid when filling a hole. 2006-01-14 08:57:40 +00:00
yamt 24c6af7659 mountd_set_exports_list: check if VFS_VPTOFH actually works. 2006-01-05 12:21:00 +00:00
yamt 28b96a0b9d ensure the export list is not changed during nfsd operations. 2006-01-05 11:22:56 +00:00
yamt 789fa21531 fix a deadlock due to a spl problem. 2006-01-03 22:25:48 +00:00
yamt 463bed6af1 de-__P. 2006-01-03 12:59:49 +00:00
yamt dbf3dbe4b0 don't install nfs_var.h. 2006-01-03 12:47:51 +00:00
yamt 27dc8f3f48 move function prototypes from nfs.h to nfs_var.h. 2006-01-03 12:30:46 +00:00
yamt 7416ebb551 nfssvc_nfsd: reduce a chance for a slow peer to capture all our threads.
instead of sleeping to wait for the socket to send our reply,
just hand-off our reply to the thread which is holding the socket.
2006-01-03 12:30:01 +00:00
yamt a5da6cae5b remove a few unnecessary caddr_t casts. 2006-01-03 11:41:50 +00:00
yamt acff143090 improve nfsd locking.
- don't bother to take nfs_sndlock when doing nfsrv_rcv.
  unlike client, we never reconnect.
- nfsrv_getstream: fix the case that m_split sleeps.
- free socket in nfsrv_slpderef rather than nfsrv_zapsock.
  fix race with nfssvc_nfsd.
- while i'm here, remove NFSD_WAITING and NFSD_REQINPROG
  as they are redundant.
- some comments and assertions.
2006-01-03 11:41:03 +00:00
yamt 07684acc5e nfs_inactive:
- use LK_CANRECURSE instead of LK_RECURSEFAIL.
  PR/32435 from Valeriy E. Ushakov.
- panic explicitly if the parent directory has been revoked.
  add an XXX comment.
2006-01-02 21:43:24 +00:00
jmmv e7b8314535 Avoid dereferencing the lwp parameter in nfs_receive, as it is always NULL.
Solves a crash when mounting NFS shares.  (The proc parameter used before
the conversion to lwp's was NULL too, so the addition of 'l->l_proc' in the
code was extra.)
2005-12-30 10:35:44 +00:00
yamt d085790ab8 netcred_lookup: remove a wrong assertion and handle the case properly. 2005-12-15 21:46:31 +00:00
reinoud 255662c92a Fix of panic that was introduced since ktrace-lwp branch was merged. The
shortcut to the process of the passed lwp paniced the kernel since lwp
could/can be passwd as NULL in VOP_WRITE().

This was happening when ktracing to NFS. The function ktrwrite() set the
uio_lwp to NULL and then calls VOP_WRITE() with this argument. nfs_write()
then accessed lwp *l->l_proc wich paniced.

Thanks to David Laight for his help on tracking it down.
2005-12-13 13:12:18 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
yamt 221616873d merge yamt-readahead branch. 2005-11-29 22:52:02 +00:00
thorpej 49fc1cb09c Use a once control to initialize the NFS server / client shared data
from nfs_vfs_init() or sys_nfssvc().  Remove the nfs_init() call from
main().
2005-11-25 20:01:38 +00:00
yamt b0cf681a01 - reduce number of linear search per rpc.
- coalesce mount_netexport_pair into netexport.
2005-11-22 04:44:29 +00:00
yamt f1bf6425bc use c99 initializers for proct. 2005-11-21 09:39:02 +00:00
yamt 6e0ca2f323 fix bugs introduced by the recent exports list rototill.
- mountd_set_exports_list: don't discard error.
- nfs_update_exports_30: check the correct flag.
2005-11-20 06:23:44 +00:00
yamt df6c7b914b nfs_read: return EISDIR rather than EPERM for !VREG files. 2005-11-05 19:21:14 +00:00
yamt a0a8d930a4 nfs_bioread: push delayed truncation and tweak loop accordingly.
PR/31926 from Jed Davis.
2005-11-04 19:39:30 +00:00
yamt a748ea88dd merge yamt-vop branch. remove following VOPs.
VOP_BLKATOFF
	VOP_VALLOC
	VOP_BALLOC
	VOP_REALLOCBLKS
	VOP_VFREE
	VOP_TRUNCATE
	VOP_UPDATE
2005-11-02 12:38:58 +00:00
thorpej f243f4debb Fix paste-o in the NFSV3SATTRTIME_TOSERVER case of mtime handing (need
to set va_mtime, not va_atime).
2005-10-31 14:21:35 +00:00
yamt 793a63d824 - remove a ufs dependency.
- bump readdir block size to 1024.  (the same value as userland DIRBLKSIZ)
2005-10-06 10:23:01 +00:00
yamt e10443f324 nfs_bioread: handle file truncation on the server a little more gracefully. 2005-10-06 10:20:58 +00:00
jdolecek 5fbad4b597 use killproc() for killing the process due to text file modification, so
that it's logged too

PR: 17392 by Greg A. Woods
2005-10-01 21:09:03 +00:00
yamt 17269a9baf nfsm_srvsattr: use nanotime(9) rather than time(9) for NFSV3SATTRTIME_TOSERVER. 2005-10-01 06:13:55 +00:00
jmmv 3955cf65f9 Add some COMPAT_30 code to let old mountd binaries work after the NFS
exports rototill.
2005-09-25 21:57:40 +00:00
tron d8706f77dd Correct typo in last commit to fix compilation error. 2005-09-25 12:49:09 +00:00
christos c5dae239cc Add missing TIMEDOUT and IO errors. 2005-09-25 02:48:40 +00:00
christos a6ce8d7c4d Convert from nfs error values to regular errno's. Although most values of
nfs errors are chosen to be the same as errno, some of them are not and
it is better for portability to do the conversion anyway. Also a server
can return a bad error number that can cause the server to crash, because
it can have the high bits that are used internally set. This was the case
with amd. Finally nfs_request() should return a valid errno, because we
can return a bogus value to userland. Thanks to rpaulo for debugging this.
2005-09-25 00:20:38 +00:00
jmmv 50cbbb8bf4 Remove the mount<->netexport entry from the map during umount... otherwise
we leave a dangling pointer in the list *ouch*.
2005-09-23 19:39:15 +00:00
jmmv 2a3e5eeb7c Apply the NFS exports list rototill patch:
- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
  function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
  file sys/nfs/nfs_export.c.  The former was becoming large and its code
  is always compiled, regardless of the build options.  Using the latter,
  the code is only compiled in when NFSSERVER is enabled.  While doing this,
  also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
  path and a set of export entries.  At the moment it can only clear the
  exports list or append entries, one by one, but it is done in a way that
  allows setting the whole set of entries atomically in the future (see the
  comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
  that it becomes file system agnostic.  In fact, all this whole thing was
  done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
  exports initialization; done internally by the kernel when initializing
  the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
  subsystems can run arbitrary code upon receipt of specific VFS events.
  At the moment, this only provides support for unmount and is used to
  destroy NFS exports lists from the file systems being unmounted, though it
  has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
2005-09-23 12:10:31 +00:00
christos 7c86163536 ATTRTIMEO takes 2 args. 2005-09-19 00:49:52 +00:00
christos 8f69843f6a Allow turning off the attribute cache. 2005-09-18 23:44:54 +00:00
rpaulo 9c8a38bb3b Wrap a multiple line comment so that it doesn't go beyond 80 columns. 2005-09-11 20:19:31 +00:00
jmmv 86e1067af8 Set va_type to VLNK before calling VOP_SYMLINK to match the change in the
vfs_syscalls.c file.  Pointed out by yamt@.
2005-09-06 09:36:28 +00:00
yamt b247716cf3 as we now have 64bit ino_t, no need to truncate nfsv3 fileids. 2005-08-19 12:47:23 +00:00
yamt 437ecc32b5 fix some simple bugs in the 64bit ino_t changes.
- edp -> dp
- * -> +
2005-08-19 10:08:48 +00:00
christos 50f8955b6e 64 bit inode changes. 2005-08-19 02:04:03 +00:00
onoe 5c08c84474 Fix mbuf leak in nfssvc_nfsd(). 2005-08-03 06:25:11 +00:00
yamt d5c148af81 use a correct credential for readlink. discussed on source-changes@. 2005-07-21 10:39:46 +00:00
yamt 445a39080e nfs_doio_read: revert readlink part of 1.129 and 1.130 because they were wrong. 2005-07-21 10:37:36 +00:00
christos d9a0117f1e Back to using curproc in the VLNK case when uiop->uio_procp == NULL,
and explain why we need to.
2005-07-07 14:26:37 +00:00
christos c7f5a1fb60 1. use p = uio->uio_procp consistently and eliminate suspicious uses
of curproc (where uio->uio_procp should be used?). Don't do this
   for nfs_commit(), because yamt says it is possibly wrong.
2. nfs_doio() does not use struct proc; remove it and the code to compute it.
3. use copyin_proc() and copyout_proc() instead of copyin() and copyout().
4. check return of copyout_proc(). and mark return from copyin_proc() XXX
5. Eliminate check p == curproc assertion check from nfs_write;
   nfs_read does not have it and we might be called in a different
   process context anyway (PR 20138).
2005-07-07 02:05:03 +00:00
yamt 44d128fa8e - constify genfs_ops.
- use member designators.
2005-06-28 09:30:37 +00:00
atatat 420d91208b Properly fix the constipated lossage wrt -Wcast-qual and the sysctl
code.  I know it's not the prettiest code, but it seems to work rather
well in spite of itself.
2005-06-09 02:19:59 +00:00
christos e7c15fae96 - sprinkle const
- avoid shadowed variables
- mark bad const use with XXXUNCONST
2005-05-29 20:58:13 +00:00
yamt 9cb572b112 nfsrv_mknod: reject device numbers which we can't handle. 2005-05-18 12:57:34 +00:00
christos 362a4a0bd5 Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
2005-05-17 04:14:57 +00:00
yamt c5544c42b5 nfsrv_rcv: don't do so_receive from socket upcall context.
while there's little benefits, it complicates locking and confuses
flow control.
2005-03-29 09:22:35 +00:00
thorpej e633e8b61b - Define a VFS_ATTACH() macro that places a reference to a vfsops structure
into the "vfsops" link set.
- Use VFS_ATTACH() where vfsops are declared for individual file systems.
- In vfsinit(), traverse the "vfsops" link set, rather than vfs_list_initial[].
2005-03-29 02:41:05 +00:00
perry bcfcddbac1 nuke trailing whitespace 2005-02-26 22:31:44 +00:00
yamt 12ee5f9c3a nfs_namei: return EACCES for empty filenames as rfc1813 says. 2005-01-28 10:12:23 +00:00
yamt 2520660990 nfs_clearcommit: don't attempt to clear commit info (n_pushlo, etc)
unless the vnode is of VREG.  union members used to keep commit info
are used for other purposes in the case of !VREG.
2005-01-28 10:11:31 +00:00
yamt f1661c75d1 - simplify nfs_bio.c rev.1.126
- add an assertion.

no functional changes.
2005-01-27 12:46:42 +00:00
yamt cf56f2b873 keep directory eof cache when inactivating vnode
because there's no reason to throw it away.
(fix an unintended side effect of nfs_subs.c rev.1.144.)
2005-01-27 11:33:26 +00:00
yamt 407a63dc34 nfs_bioread:
- if a buffer is still empty after successful nfs_doio, it implies EOF.
- don't cache blocks beyond EOF.
2005-01-27 11:29:25 +00:00
yamt f6e331ee7c nfs_readdirrpc, nfs_readdirplusrpc:
avoid infinite loops when getting readdir response without
any entries or eof.  PR/28971.
2005-01-26 10:33:54 +00:00
yamt 72d6e88acf handle a really empty directory, which doesn't have even the dot entry. 2005-01-26 10:30:58 +00:00
yamt a7b5d8f567 nfs_check_wccdata: comment. 2005-01-25 12:20:32 +00:00
yamt de3e729ad9 s/time/mono_time/ for n_attrstamp and n_accstamp. (parts of) PR/25641. 2005-01-21 14:31:29 +00:00
yamt fc08656a20 implement inaccurate mtime/ctime detection.
namely, if mtime or ctime are same between pre_op_attr and post_op_attr
when we expected them to be changed, don't trust the server.
2005-01-19 16:22:19 +00:00
chs 8975a0856f adjust the UBC mapping code to support non-vnode uvm_objects.
this means we can no longer look at the vnode size to determine how many
pages to request in a fault, which is good since for NFS the size can change
out from under us on the server anyway.  there's also a new flag UBC_UNMAP
for ubc_release(), so that the file system code can make the decision about
whether to cache mappings for files being used as executables.
2005-01-09 16:42:43 +00:00
yamt e5bd47dc3c invalidate cache if filesize is changed besides our activity
because it means that we're out of sync with the server.
2005-01-09 01:32:32 +00:00
yamt 68c071389c nfs_lookup: check n_nctime for positive entries as well to improve
cache consistency.
2005-01-08 03:12:30 +00:00