Commit Graph

118 Commits

Author SHA1 Message Date
chs c398ae9734 a smorgasbord of improvements to vnode locking and path lookup:
- LOCKPARENT is no longer relevant for lookup(), relookup() or VOP_LOOKUP().
   these now always return the parent vnode locked.  namei() works as before.
   lookup() and various other paths no longer acquire vnode locks in the
   wrong order via vrele().  fixes PR 32535.
   as a nice side effect, path lookup is also up to 25% faster.
 - the above allows us to get rid of PDIRUNLOCK.
 - also get rid of WANTPARENT (just use LOCKPARENT and unlock it).
 - remove an assumption in layer_node_find() that all file systems implement
   a recursive VOP_LOCK() (unionfs doesn't).
 - require that all file systems supply vfs_vptofh and vfs_fhtovp routines.
   fill in eopnotsupp() for file systems that don't support being exported
   and remove the checks for NULL.  (layerfs calls these without checking.)
 - in union_lookup1(), don't change refcounts in the ISDOTDOT case, just
   adjust which vnode is locked.  fixes PR 33374.
 - apply fixes for ufs_rename() from ufs_vnops.c rev. 1.61 to ext2fs_rename().
2006-12-09 16:11:50 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
reinoud 0ce809091d Replace the LIST structure mp->mnt_vnodelist to a TAILQ structure since all
vnodes were synced and processed backwards. This meant that the last
accessed node was processed first and the earlierst last.

An extra benefit is the removal of the ugly hack from the Berkly days on
LFS.

In the proces, i've also replaced the various variations hand written loops
by the TAILQ_FOREACH() macro's.
2006-10-20 18:58:12 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
christos cb09e23ee7 fix incomplete initializer 2006-08-29 23:45:23 +00:00
christos f62871cb73 Fix incomplete initializer 2006-08-29 23:43:12 +00:00
ad 3029ac48c7 - Use the LWP cached credentials where sane.
- Minor cosmetic changes.
2006-07-21 16:48:45 +00:00
elad 874fef3711 integrate kauth. 2006-05-14 21:19:33 +00:00
christos 08172fe2d0 COVERITY CID 1113: Don't use NULL for VOP_READDIR 2006-04-12 01:05:14 +00:00
christos c904bed6a0 Coverity CID 2319: Plug memory leak. 2006-04-12 00:59:56 +00:00
he 22d273f6af Unbreak the build of this file on our 64-bit ports
by casting to or via intptr_t.
2006-04-05 06:55:26 +00:00
gdt 4d48cb3530 Update list of todo items, and note that old items are from 1998 and
thus likely no longer correct.
2006-04-04 13:20:39 +00:00
gdt 73e63e429a Check symlink count and pointer returned from userspace before
dereferencing it.  (I added this during search for the problem fixed by
the earlier readlink buffer allocation fix, and the checks have not
triggered.  Still, it's wrong of the kernel to use pointers from user
space without validation.)
2006-04-04 13:11:08 +00:00
gdt e854a7f59c Add comments explaining how the 3 size variables for venus calls are
used.

Remove defect in size allocation for coda_readlink to avoid having
venus write outside malloced space by including pathname space before
allocation.

Add asserts that cred structure is non-NULL and non-FSCRED.

Check lwp against NULL before dereferencing it.

Assert that output pointer is non-NULL on a few venus returns.  This "can't
happen" but has been seen in crash dumps.

With these changes, the following work on a 345 MB coda volume.
(Before, a single invocation of tar or pax on this volume would
crash.)

$ for i in $(seq 1 10); do find . -type f -print0 |xargs -0 md5 > MD5.$i & done

Two copies of

$ for i in $(seq 1 10); do pax -w /coda/[redacted] >/dev/null & done


(lwp NULL check semi-reviewed by wrstuden@)
2006-03-15 14:30:56 +00:00
gdt 94a375ec39 Change type of 'inode' member of struct coda_open_out to ino_t. This
holds a host system inode denoting a container file, not a coda inode
type.  Tested with CVS coda on i386.  Reviewed by christos@.
2006-03-02 14:24:57 +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
gdt 6fbdb2adf5 In coda_lookup, add LK_RETRY to locking of child vnode. The previous
code paniced if the first attempt to lock the vnode failed, and such
failures are not errors - just cause to wait.  gdt was regularly
hitting this panic.

Correct one of two identical panic messages.

Add XXX comments about

  ISDOTDOT locking rules not being followed

  questioning the practice of unlocking parent before locking child.
  (But, given that the vnode is referenced, it can't be deleted, so
  maybe this is fine.)

  Why is failured to unlock not a panic but failure to lock is?
2006-01-12 14:57:06 +00:00
perry 3d4ed1fbc7 __inline__ -> inline 2005-12-24 23:41:33 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +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
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
xtraeme 323d4b7a78 oops, fix previous. 2005-08-30 22:27:16 +00:00
xtraeme 535b5fed29 * Remove __P()
* Use ANSI function declarations
2005-08-30 22:24:11 +00:00
christos 2f6bd96c17 coda inodes are still 32 bits. Don't use ino_t in coda_open_out. 2005-08-28 08:57:45 +00:00
christos 758a209d23 64 bit inode changes. 2005-08-19 02:03:49 +00:00
blymn 39f1a744f7 Add attach call so coda gets added to list of vfs supported by the kernel. 2005-07-02 07:05:27 +00:00
christos 81cb2a7668 - sprinkle const
- avoid shadowed variables.
2005-05-29 21:05:25 +00:00
perry 477853c351 nuke trailing whitespace 2005-02-26 22:58:54 +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
skrll de13910b03 Revert previous. set_statvfs_info needs the struct proc * arg.
Problem noted by Tom Ivar Helbekkmo on current-users
2004-10-15 09:09:09 +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
petrov 2f0beeefc5 Fix coda symlink vnodeops. Provided by Greg Troxel. PR kern/25963. 2004-06-25 02:52:46 +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
atatat 10a7ba9ef6 Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
2004-05-20 06:34:24 +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
christos 90345b38a6 add sys/dirent.h 2004-04-21 02:40:42 +00:00
christos 6bd1d6d4db Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
2004-04-21 01:05:31 +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
atatat a451cb447e Fix spelling of "orphan" and placement of */ 2004-03-09 03:14:09 +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
simonb b6abb6ab1d Remove some assigned-to but otherwise unused variables. 2003-10-30 01:58:17 +00:00
mrg 4245208cbc don't include opt_coda_compat.h unless _KERNEL_OPT. also, only include it
once...
2003-08-28 05:55:19 +00:00
drochner 1b88840c66 update for the protocol used by coda>=6,
patches supplied by the coda-6.0.2 distribution,
with small changes to support the old protocol optionally
(options CODA_COMPAT_5)
2003-08-27 17:49:48 +00:00
drochner 25df17af88 fix a deadlock during mount:
The client manager (venus) blocks in sys_mount() before entering its
event loop answering requests from the kernel device (cfs). sys_mount()
calls VFS_STATFS() internally which caused an upcall through cfs,
which was never answered.
Now don't consider the fs fully mounted before the VFS_START() was
called at the vey end of sys_mount(). So VFS_STATFS() will return
an error which is ignored.
2003-08-25 10:05:46 +00:00
drochner eacc9ee5ce nuke an over-zealous memset() which broke statfs() et al. completely 2003-08-25 09:24:53 +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
thorpej 3a56e3ea7e Adjust for ktrace/lwp changes. 2003-06-29 02:16:59 +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