Commit Graph

915 Commits

Author SHA1 Message Date
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
yamt f80647ef1e nfs_loadattrcache: invalidate access cache when ctime is changed. 2005-01-06 11:52:44 +00:00
thorpej 1c95472d01 Add the system call and VFS infrastructure for file system extended
attributes.

From FreeBSD.
2005-01-02 16:08:28 +00:00
yamt f4221aaaf6 revive spec vop_bwrite as it's needed for block devices.
PR/28684 from Jukka Salmi.
2004-12-17 03:31:20 +00:00
yamt ee344f939f redirect some VOPs which shouldn't be used for nfs
to genfs_badop (ie. panic).
2004-12-14 09:15:23 +00:00
yamt e3ed5def47 - centerize code to invalidate stale cache.
- don't ignore errors when invalidating buffers in nfs_open.
2004-12-14 09:13:13 +00:00
bouyer 0f82537ed4 The macro used for static server address is NFS_BOOTSTATIC_SERVADDR, not
NFS_BOOTSTATIC_SADDR. From Xen source distribution.
XXX NFS_BOOTSTATIC* doesn't seem to be documented anywhere ...
2004-12-12 16:24:14 +00:00
yamt 8cd5f554ba nfsrv_commit: make cnt unsigned so that very large commit requests can be
handled properly.
2004-12-09 02:18:45 +00:00
yamt 2bc7120ab8 when calling create-type VOP, make sure that va_mode is set
even when a client doesn't specify it.
(most filesystems get confused if va_mode is VNOVAL.)
2004-12-09 01:48:22 +00:00
yamt f11ea18093 nfsrv_read: fall back to copying when fail to loan pages.
(i forgot to commit this with uvm_loan.c rev.1.51.)
2004-12-04 08:07:52 +00:00
yamt a9fa9f0745 since daddr_t is 64-bit these days, simply use nfs directory cookies
as buffer cache indexes.  regress/sys/fs/getdents is now supposed to work.
fix PR/27112.
2004-10-26 04:34:46 +00:00
yamt 20a0770136 remove #if 0'ed out definition of VA_EXCLUSIVE. 2004-10-26 00:58:54 +00:00
yamt 3d250e0476 remove an unused macro, NMOD. 2004-10-26 00:27:07 +00:00
yamt 94223b8ff0 nfs_enterdircache: initialize dc_flags of a newly allocated dircache entry.
provided by Greg Oster.
2004-10-03 10:51:28 +00:00
yamt 31c025d90c nfs_readdirrpc, nfs_readdirplusrpc:
don't expose kernel garbage data to userland.
2004-10-03 10:17:33 +00:00
yamt 6b8cd53946 nfs_writerpc: fix PHOLD leak on error. 2004-10-01 01:08:01 +00:00
yamt 77b63b73b8 g/c NFSMINOFF, which is unused and identical with MRESETDATA. 2004-09-29 11:24:28 +00:00
yamt ac65f2420a nfs_readdirplusrpc: fix spurious EBUSYs. 2004-09-23 10:46:44 +00:00
skrll f7155e40f6 There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
2004-09-17 14:11:20 +00:00
yamt e11d5e7c46 fix access-after-free bugs in dircache code by refcounting nfsdircache.
PR/26864.
2004-09-15 09:50:56 +00:00
yamt 4fd5a025bf nfs_request: a workaround for servers doing "maproot".
for i/o requests which are expected not to fail due to permission
to mimic unix file open semantics (READ, WRITE, COMMIT),
try two credentials.  namely, the file owner's one and open time one.
remember which credential worked in per-file basis and try it first
next time to minimize number of retries.
ideas from Chuck Silvers.  PR/23716 and PR/24987.
2004-08-24 20:09:44 +00:00
yamt bee0b74932 remove a "proc botch" debug printf. ok'ed by Jonathan Stone. 2004-08-18 23:44:47 +00:00
mycroft 45a21b76f0 Fixing age old cruft:
* Rather than using mnt_maxsymlinklen to indicate that a file systems returns
  d_type fields(!), add a new internal flag, IMNT_DTYPE.

Add 3 new elements to ufsmount:
* um_maxsymlinklen, replaces mnt_maxsymlinklen (which never should have existed
  in the first place).
* um_dirblksiz, which tracks the current directory block size, eliminating the
  FS-specific checks littered throughout the code.  This may be used later to
  make the block size variable.
* um_maxfilesize, which is the maximum file size, possibly adjusted lower due
  to implementation issues.

Sync some bug fixes from FFS into ext2fs, particularly:
* ffs_lookup.c 1.21, 1.28, 1.33, 1.48
* ffs_inode.c 1.43, 1.44, 1.45, 1.66, 1.67
* ffs_vnops.c 1.84, 1.85, 1.86

Clean up some crappy pointer frobnication.
2004-08-15 07:19:54 +00:00